Re: New looping method proposal

From: Date: Mon, 19 Nov 2001 18:54:52 +0000
Subject: Re: New looping method proposal
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-1972@lists.php.net to get a copy of this message
We should probably stick to the language construct of {func attr1=$foo attr2=$bar} {/func} "Thies C. Arntzen" wrote: > > On Mon, Nov 19, 2001 at 12:03:50PM -0600, Andrei Zmievski wrote: > > On Mon, 19 Nov 2001, Ivo Jansch wrote: > > > Mind you, my proposal is also usable for nested sections! (Andreas' > > > remark was not correct) > > > > > > Consider this: > > > > > > {foreach $projects as $project} > > > > > > {$project.title} > > > <br> Here are the contactpersons for this project: > > > <ul> > > > {foreach $project.contactpersons as $contact} > > > <li>{$contact.name} > > > {/for} > > > </ul> > > > {/for} > > > > > > Is this not far more easy then the current method of nesting sections? > > > > > > The only thing not possible in my approach is Monte's remark about > > > indices. But that was covered by my second proposal: > > > > > > {foreach $projects as $index => $project} > > > <br> something from another array: {$prices[$indes]} > > > {/for} > > > > I am willing to entertain the idea of this construct, because it will > > solve the problem of looping through non-sequential or associative > > arrays. However, I do not think that I want to use the same syntax as > > PHP does. Can we come up with something better? > > {loop [over] $array as $index => $value} > {/loop} > > ?? > > --- > 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 (#1972) next »