Re: [SMARTY] Variable bleed??

From: Date: Tue, 10 Dec 2002 22:30:55 +0000
Subject: Re: [SMARTY] Variable bleed??
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6720@lists.php.net to get a copy of this message
template variables are currently extracted into PHP name space, then the template files get included. This may change though, there has been threads on in before. On Tue, 2002-12-10 at 15:30, Gerard Samuel wrote: > I just ran into a scenario, and Im not sure how its happening. > I have a page that displays "blocks" along with center content. > One block on the left is a poll. In the poll block's php code Im using > an array $data. One template variable comes from the php $data array -> > $smarty->assign('poll_option', $data['options']); > In all my scripts I make it a habit to assign, display, then clear > template variables. > Now on this one page, the center content is getting a template array "data". > $smarty->assign('data', $file); > Im using {foreach} to loop throught the template array like so -> > {foreach item=line from=$data} > {$line} > {/foreach} > > For some reason, the template loop is displaying the last row of the > array $data from the poll block. > The quick and easy could be to rename the center content template > variable. But what is the general consensus about variable naming > for templates? Is it possible for php variables, and template variables > to clash? What is additionally confusing is that both the poll block and > center content are in functions. Those variables should only exist in > their particular functions. > > Ill keep looking, but if anyone has run into something like this, Ill be > glad to hear what you have to say... > > Thanks for listening... > > -- > Gerard Samuel > http://www.trini0.org:81/ > http://dev.trini0.org:81/ -- Monte Ohrt <monte@ispi.net>

« previous php.smarty.general (#6720) next »