Re: New looping method proposal

From: Date: Mon, 19 Nov 2001 11:30:30 +0000
Subject: Re: New looping method proposal
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-1950@lists.php.net to get a copy of this message
Hi, Mirko Buffoni wrote:
in 9 out of 10 cases you do not need the ability of nesting sections.
So I think I'm in the 10% of the cases. There are several occasions where I used nesting sections, and I found it tremendously useful.
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}
to rewrite the templates, if looping method changes. So I'm here to express my opinion on the topic too.
It could ofcourse be implemented as an addition, so sections shall still work. Greetings, Ivo -- Ivo Jansch <ivo@ibuildings.nl> ibuildings.nl BV - information technology http://www.ibuildings.nl

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