From smarty-general Mon Feb 02 08:47:38 2004 From: Gabriel Birke Date: Mon, 02 Feb 2004 08:47:38 +0000 To: smarty-general Subject: Re: [SMARTY] evaluate data recursive Message-Id: <742771A4-555C-11D8-980F-003065FA313E () kontor4 ! de> X-MARC-Message: https://marc.info/?l=smarty-general&m=107571166326433 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 > > -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php