Toby Allen
Toby Allen

Reputation: 11213

smarty.get no longer working

I have some old php code that has been working happily. I need to do some updating and have moved the code to another machine. Everything is fine except this smarty code no longer works.

{$smarty.get.myvar}

I know it must be to do with differnt config settings but i can't figure it out. Register_Globals is off on both installations.

Upvotes: 0

Views: 1857

Answers (3)

Esty Shlomovitz
Esty Shlomovitz

Reputation: 159

Try to use this option:

{$smarty.get['myvar']} 

I had this issue, and with this syntax it works

Upvotes: 0

mike
mike

Reputation: 5213

The documentation for the "global" variables is here http://www.smarty.net/manual/en/language.variables.smarty.php

Make sure you have request_vars_order and request_use_auto_globals configured to your needs, but the syntax $smarty.get.myvar is completely fine.

Make sure the case is correct and you are not sending $smarty.get.myVar...

Upvotes: 1

Vladislav Rastrusny
Vladislav Rastrusny

Reputation: 29985

This is a BAD way of working with request variables. Template should never fetch the variables directly from GPC vars. Variables should be validated by script, sanitized and then ->assigned to a template.

Upvotes: 2

Related Questions