Re: [SMARTY-GENERAL] How can I print an $array[index] in a section?

From: Date: Sun, 07 Apr 2002 17:39:04 +0000
Subject: Re: [SMARTY-GENERAL] How can I print an $array[index] in a section?
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3538@lists.php.net to get a copy of this message
You can do this without a loop: {$leftmenu.entry1} {$leftmenu.entry2} Otherwise, {foreach ...} is more suited for looping an associative array. Jones Down wrote:
Hi, i have a menu-array like this: $leftmenu = array ('entry1' => 1, 'entry2'=>5, 'entry3'=>12); Now I want to loop the entries, I am trying like this: {section name=menuleft loop=$leftmenu} <tr><td>{$leftmenu[menuleft][0]}</td></tr> {/section} but nothiung happens- what am i doing wrong? Thanks for your attention, Jones


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