Re: [SMARTY] How to pass an array to an included template

From: Date: Thu, 20 Mar 2003 07:31:55 +0000
Subject: Re: [SMARTY] How to pass an array to an included template
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-8761@lists.php.net to get a copy of this message
On Wed, Mar 19, 2003 at 10:26:26PM +0100, Didier wrote: > The subject more or less says it all. > > I have the following scenario: > > All my pages have the same layout ie: page title, a bar on the left with > some 'menu' entries made of hrefs... > > I have decided to put the header & menu displaying in one tpl that > should just be included by all other .tpl. > > I must be stupid, but have not found a way to send arrays to an included > file. Sending single variables is fine, arrays beats me. it should make not difference to strings. if you assign $smarty->assign('menu', array(1,2,4,5)) in the php before, then {$menu} should be visible in all templates. if you {include "nav.tpl" nav=$menu"} then {$nav} should also be an array. > Any help will be warmly welcomed. > > Didier

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