smarty.get no longer working

0 votes
asked Oct 11, 2009 by toby-allen

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.

3 Answers

0 votes
answered Oct 13, 2009 by michal-kralik

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...

0 votes
answered Oct 15, 2009 by vladislav-rastrusny

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.

0 votes
answered Sep 15, 2017 by esty

Try to use this option:

{$smarty.get['myvar']} 

I had this issue, and with this syntax it works

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter

...