List Info

Thread: questions




questions
user name
2007-08-23 12:32:07
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  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: questions
user name
2007-08-23 12:45:44
Actually 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 <joshtrutwins.homeip.net>
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  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
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )