How can I print an $array[index] in a section?

From: Date: Sun, 07 Apr 2002 17:14:32 +0000
Subject: How can I print an $array[index] in a section?
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3534@lists.php.net to get a copy of this message
Hi, thanks for the fast answers, BUT... > thus you probably want to do sth. like {$leftmenu[menuleft].0}, but as does not work - shows nothing > {$leftmenu[menuleft]} would be the right thing to do ;-) also shows nothing... ??? array is: Thanks, dwerg, of course I have a smarty-object and I did assign the value... I did work with other template classes, but I am not satisfied with them, so basic knowledge about templates is here... but what did I do wrong? like this: index.php --------- define("SMARTY_DIR","../inc/"); require_once (SMARTY_DIR.'Smarty.class.php'); $sm = new Smarty; $leftmenu = array( 'ENTRY1' => 1, 'ENTRY2' => 3, 'BLA' => 4, 'SOME MORE' => 5 ); $sm->assign('leftmenu', $leftmenu); $sm->display('index.tpl'); index.tpl --------- ...lots of html... {section name=menuleft loop=$leftmenu} <tr><td>{$leftmenu[menuleft]}</td></tr> {/section} The debug-console shows that array is assigned, but there seems to be no way to access indices of ass. arrays in sections... at least i did not find anything about that in the docs? I can not access the key-name in the section, because I want to loop... :)) Any hints? Or is this a missing feature? Thanks for your attention! Jones

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