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

scope issue

 
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 -> Bugs
View previous topic :: View next topic  
Author Message
shuther
Smarty Rookie


Joined: 04 Jan 2004
Posts: 13

PostPosted: Mon Jan 19, 2004 4:32 pm    Post subject: scope issue Reply with quote

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


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Wed Jan 21, 2004 9:26 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
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 -> Bugs 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