|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
bsmither Smarty Elite
Joined: 20 Dec 2011 Posts: 322 Location: West Coast
|
Posted: Tue Dec 01, 2015 9:15 pm Post subject: Set Value to $smarty |
|
|
Related to this:
http://www.smarty.net/forums/viewtopic.php?p=55235
When looking at the {debug} console, the $smarty variable has a value of null.
This is the instantiation:
$GLOBALS['smarty'] = new Smarty();
I am trying to set a key/value in the superglobal $_SESSION array in one template:
{$smarty.session.order_has_digital=false}
and read it back in a different template (same PHP session).
Is $smarty read-only? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Dec 01, 2015 11:01 pm Post subject: |
|
|
I hope you're not working for a company.
Because if you were working for me, you'd had some bones broken for that code already.
One for using $GLOBALS at all, one for creating new variables directly in it, and one for braindead template design.
You MUST NOT try to SET any values in the application FROM THE TEMPLATE.
Fix your code, and your "problem" will go away. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu Dec 10, 2015 4:52 am Post subject: |
|
|
You can't assign values to the $smarty special variables. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|