Re: [SMARTY] Inkluding a template into a template more than once

From: Date: Wed, 24 Sep 2003 13:36:02 +0000
Subject: Re: [SMARTY] Inkluding a template into a template more than once
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10262@lists.php.net to get a copy of this message
On Wed, Sep 24, 2003 at 02:44:01PM +0200, Webmaster wrote: > Hi, > > how does one include a templated repeatedly but assign the variable > different values? > In my case I want to have several menutables on the left. The menu entries > consist of an array that I pass to a function which passes it to the > template. > > The array passed is called $menuItems. It is two dimensional. > But for each table it has different entries. {foreach from=$menuItems item=$menu} {include file="left_menu.tpl"} {* you can use $menu inside left_menu.tpl, it changes on each iteration *} {/foreach} you can also pass variables to included templates with {include file="..." name1=value1 name2=value2 ...} (with arbitrary "name1", name2 etc, only "file" and "assign" are reserved names) you would need this if the loop-variable ("$menu" above} was called different inside "left_menu.tpl". > Thank you very much. > > webmaster

« previous php.smarty.general (#10262) next »