|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
{include} questionsFrom the docs:
"All assigned variable values are restored after the scope of the included template is left. This means you can use all variables from the including template inside the included template. But changes to variables inside the included template are not visible inside the including template after the {include} statement." Is there any way for an included template to pass data back to the template that includes it? I have some included templates that do something that I want the including template to know about. My only thought was to use the assign attribute and parse the results before displaying them - but that seems pretty ugly. One last question - if you can "se all variables from the including template inside the included template" what is the point of passing a variable in like this: {include file='temp.tpl' foo=$bar} Thanks, Josh -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
|
Re: {include} questionsActually it depends on how you render the templates, for example in
http://www.dinahosting.com -a 100% smarty site- since the inner template is rendered first it can setup variables or modify what I call world objects. Actually, teh best way to show a hierchaly constructed page is to parse first the inner stuff until you've finally the full page constructed. On 8/23/07, Josh Trutwin <josh@...> wrote: > > From the docs: > > "All assigned variable values are restored after the scope of the > included template is left. This means you can use all variables from > the including template inside the included template. But changes to > variables inside the included template are not visible inside the > including template after the {include} statement." > > Is there any way for an included template to pass data back to the > template that includes it? I have some included templates that do > something that I want the including template to know about. > > My only thought was to use the assign attribute and parse the results > before displaying them - but that seems pretty ugly. > > One last question - if you can "se all variables from the including > template inside the included template" what is the point of passing a > variable in like this: > > {include file='temp.tpl' foo=$bar} > > Thanks, > > Josh > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Vicente Werner y Sánchez |
| Free embeddable forum powered by Nabble | Forum Help |