Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Set Value to $smarty

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
bsmither
Smarty Elite


Joined: 20 Dec 2011
Posts: 322
Location: West Coast

PostPosted: Tue Dec 01, 2015 9:15 pm    Post subject: Set Value to $smarty Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Tue Dec 01, 2015 11:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Thu Dec 10, 2015 4:52 am    Post subject: Reply with quote

You can't assign values to the $smarty special variables.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP