RE: [SMARTY] Template inside template
| From: | David Zülke | Date: | Sun, 09 Jan 2005 00:05:12 +0000 |
| Subject: | RE: [SMARTY] Template inside template | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-12125@lists.php.net to get a copy of this message | ||
You'd usually include menu.php using {include_php} inside the index.tpl.
David
> -----Original Message-----
> From: news [mailto:news@sea.gmane.org] On Behalf Of Rainer Müller
> Sent: Sunday, January 09, 2005 12:58 AM
> To: smarty-general@lists.php.net
> Subject: Re: [SMARTY] Template inside template
>
> HarryG wrote:
> > But will this also call the menu.php. Because there will be queries that
> > need to be run before the menu.tpl can be displayed.
>
> No, you have to include the menu.php normally into your php code with:
> --index.php--
> <?php
> // ...
> include 'menu.php';
> // ...
> $smarty->display('index.tpl'); //with {include file="menu.tpl"}
> inside
> ?>
>
> --menu.php--
> <?php
> // your queries and stuff...
>
> // the $smarty object comes directly from index.php
> $smarty->assign('menu', $menu); //example
> ?>
>
> --index.tpl--
> <DOCTYPE...>
> <html>
> <head>...</head>
> <body>
> ...
> {* the template which will loop through $menu and output it *}
> {include file="menu.tpl"}
> ...
> </body>
> </html>
>
> Rainer
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>