Re: recusive functions and Smarty

From: Date: Fri, 23 Mar 2001 14:36:15 +0000
Subject: Re: recusive functions and Smarty
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-409@lists.php.net to get a copy of this message
Two ideas: 1) Write a smarty custom function and do your recursion in PHP there. 2) Do your recursion up front in your application to populate arrays of data, then pass the arrays to the template for display in a section loop. You won't see recursion, objects, classes, etc. directly in the Smarty template language. Andreas Kaiser wrote: > > Hi, > > I use a recursive function. This function creates a structure like: > <ul> > <li>foo</li> > <li>foo</li> > <li>foo</li> > <ul> > <li>foo</li> > <li>foo</li> > </ul> > <li>foo</li> > </ul> > > There are two functions to realise this output: > child_exits($parent) and > print_child($parent) > > print_childs creates the output via echo "<li>$foo" and so on. > The recursion is also in print_childs: > if (child_exists($id)) { > print_childs($id); } > > Now I will use Smarty for this problem. But how can I deal with > recursion in Smarty? > Any hints? > > Best regards > Andreas Kaiser > > -- > vocote.de e.K. Internetapplikationen, Webdesign, Webhosting > Neudörfeler Str. 4a - D-08543 Jocketa > Telefon: +49-37439-77175 - Fax: +49-37439-77185 > WWW: http://www.vocote.de - email: > mailto:info@vocote.de > > --- > You are currently subscribed to smarty as: monte@ispi.net > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/ -- Monte Ohrt <monte@ispi.net> http://www.ispi.net/

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