Re: [SMARTY] How to make templates inside templates?
| From: | Martijn van Zal | Date: | Mon, 08 Jul 2002 12:53:24 +0000 |
| Subject: | Re: [SMARTY] How to make templates inside templates? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5224@lists.php.net to get a copy of this message | ||
If you look at www.gfxartist.com you see the boxes (windows) on the right
side of the page, those are all in the database, There is a table with
pages, and a table with windows, and a table linking the two, with a order.
So I can add a window to a page in the backoffice (or database) and it will
show on the place selected.
I did this some time ago, and back then there were some problems using
variables. This is what I did
{foreach item=window from=$windows}
{php}
$this->_smarty_include("DB:".$this->_tpl_vars['window']['template'],
array('window' => $this->_tpl_vars['window']));
{/php}
{/foreach}
But now you can propably just do
{foreach item=window from=$windows}
{include file=$window.template}
{/foreach}
I have the framework of the windows in the subtemplates, because there are
also windows without a border, but you could also include the border HTML in
the example above.
I hope this helped you a bit,
Good luck,
________________________________________
Martijn van Zal GFXartist Network
Technical Manager
mail/msn: martijn@gfxartist.com
icq: 8213621
----- Original Message -----
From: "Henno Täht" <henno@japauto.ee>
> Hi,
>
> I have a web page which looks like this one:
> http://phpnuke.org/
>
> Now I'm thinking that maybe there is a painless way to somehow make some
> template code reusable. There are many similar elements on that page:
"Main
> Menu", "For the Future", "Surveys", "Cool Links" etc. I
> think it's
possible
> to 'define' the 'framework' for the box (which consists of the caption and
> the formatted borders and background) only once, somewhere. And then use
> that framework to easily add some additional boxes by only specifying the
> caption and the content. Which are the various ways doing it with smarty?
>
> Henno
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php