|
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 |
eposjk Smarty Rookie
Joined: 07 Oct 2009 Posts: 13
|
Posted: Thu Oct 08, 2009 4:42 pm Post subject: How to call a template from PHP without old variables |
|
|
How can a template be called from PHP and ensured that optional variables are empty?
Is there a way to do something like {include} did (at least in Smarty2) - call a template and delete(suspend) all variables defined earlier?
First, I thought: "thats what the new Smarty_Data objects are good for" - but they solve the problem only in one direction - avoiding local variables being accidentally used somewhere else - but how to go other way round - avoiding earlier defined variables being used in local scope? |
|
Back to top |
|
eposjk Smarty Rookie
Joined: 07 Oct 2009 Posts: 13
|
Posted: Fri Oct 09, 2009 9:12 am Post subject: |
|
|
I found it out myself - reading the code helps!
Code: | $data = new Smarty_Data( array() ); |
sets up a variable context which ignores the variables defined before! |
|
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
|