|
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 |
shuther Smarty Rookie
Joined: 04 Jan 2004 Posts: 13
|
Posted: Mon Jan 19, 2004 4:32 pm Post subject: scope issue |
|
|
Here is a new problem (or it is normal?): the variable disapears (last official release of smarty)
In a.tpl, I do this:
Code: |
{include_php file="calendar.inc.php" once="true"}
|
In calendar.inc.php, I do this:
Code: |
$smarty->assign('a, $start_time);
|
To call a.tpl, I do this:
Code: |
$fetchWorkPage = $smarty->fetch('a.tpl');
|
Then, I do this: - in the same file
Code: |
echo $this->get_template_vars('a');
|
It is working.
But, if I have a newfile b.tpl
Code: |
{include file="a.tpl"}
|
And I call it instead of a.tpl
Code: |
$fetchWorkPage = $smarty->fetch('b.tpl');
|
Then, nothing is shown for the $this->get_template_vars('a')
Maybe it is an issue of scope... |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Wed Jan 21, 2004 9:26 am Post subject: |
|
|
if you include a template and change (for example assign) variables in there then all changes are gone when the included template is done and the scope returns to the including template. that's not a bug, it's intended behaviour. it should be documented more clear on http://smarty.php.net/manual/en/language.function.include.php , though |
|
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
|