recurse sections in smarty

From: Date: Tue, 16 Dec 2003 22:15:21 +0000
Subject: recurse sections in smarty
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10711@lists.php.net to get a copy of this message
Sorry to ask two questions in one day: I have an array, where the elements can either be an id, name pair or another array containing id, name pairs (or more arrays). What I want Smarty to do is to - if the element is an id, name pair print it. - if it is another array, indent and then foreach over it and so on. This should be recursive, so that if another array is reached it is treated in the same way. Am I asking too much from Smarty here? Just as an example, the data structure might be: Array( id2, name id3, name Array( id4, name id5, name Array( id7,name ) ) id6, name ) //end array The output should be id2, name id3, name id4,name id5,name id7,name id6,name As you have probably guessed, its a menu. At the moment I am probably going to completely redo the data structure (or maybe use an object) so if anybody has any ideas I would be grateful. Benjamin Sims

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