Re: [SMARTY-DEV] assign inside a 3rd level included template
| From: | Jimmy Harlindong | Date: | Tue, 24 Jun 2003 09:26:16 +0000 |
| Subject: | Re: [SMARTY-DEV] assign inside a 3rd level included template | ||
| References: | 1 2 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-1688@lists.php.net to get a copy of this message | ||
> On Tue, Jun 24, 2003 at 06:02:52PM +1000, Jimmy Harlindong wrote:
> > I have a global template:
> >
> > <html><head>{$head}</head><body>{$body}</body></html>
> >
> > then in my php:
> >
> > // need to use this since body.tpl is actually a variable.
> > $smarty->assign('body', $smarty->fetch('body.tpl'));
> > $smarty->display('theabovetemplate.tpl');
> >
> > in body.tpl I have:
> >
> > {include file="sub-body.tpl"}
> >
> > and in sub-body.tpl:
> >
> > {assign var="head" value="xxxx"}
> >
> > Apparently this assignment to "head" variable inside sub-body.tpl doesn't
> > reach to the global template (I got empty <head></head> in the output). If I move this
> > assign smarty function to body.tpl it will work and show up in the global template
> >
> > Is this a bug or by design?
>
> it's by design. :)
Care to explain why?