Re: [SMARTY] evaluate data recursive

From: Date: Mon, 02 Feb 2004 08:47:38 +0000
Subject: Re: [SMARTY] evaluate data recursive
References: 1 2 3  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10912@lists.php.net to get a copy of this message
Hello, You can easily get the recursion depth if you modify the recursion like this (only works with Smarty 2.6 because of the math): [menu.tpl] {$item->name|indent:$depth*4:" "} {foreach from=$item->childs item=child} {include file="menu.tpl" item=$child depth=$depth+1} {/foreach} I haven't tested this but you get the principle ... With best regards Gabriel Birke -- KONTOR4_Neue Medien Plathnerstraße 5 30175 Hannover Fax: +49 51184 48 98 99 mailto:birke@kontor4.de http://www.kontor4.de Am 31.01.2004 um 16:12 schrieb Patrick Pletscher: > Hello, > > Thanks for your reply. I guess this would work quite well for my > purpose, except, that I should know how deep I am in the recursion for > putting spaces ( ) in front of the links. > > Is there a plan to include a Smarty function which could look like > this: > > {recursive from=$variable item=new type=preorder|inorder|postorder > recursive_for=$variable->childs name=my_recursion} > {smarty.my_recursion.depth} {new->name} > {/recursive} > > Because recursive datastructres are quite usefull in many areas of > computer science I think it would be a great feature if smarty could > include a function for handling them... > > Or is such a plugin written easily, I didn't know that, because I never > had the need to write a smarty-plugin > > Sincerly, Patrick > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

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