Re: New looping method proposal

From: Date: Mon, 19 Nov 2001 18:03:50 +0000
Subject: Re: New looping method proposal
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-1968@lists.php.net to get a copy of this message
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? -Andrei * My wishlist: http://www.amazon.com/exec/obidos/wishlist/2Q2DIPY7BZLSH/ *

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