Re: New looping method proposal

From: Date: Mon, 19 Nov 2001 19:13:40 +0000
Subject: Re: New looping method proposal
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-1976@lists.php.net to get a copy of this message
Why don't we just make an alternative way of using {section ...} by adding a new attribute: {* current syntax *} {section name=contacts loop=$record} {$record[contacts].firstname} {/section} {* alternate associative array method *} {section name=contacts each=$record} {$contacts.firstname} {/section} So you require one of "loop" or "each", and we don't disturb the language syntax so much. Andrei Zmievski wrote: > > On Mon, 19 Nov 2001, Monte Ohrt wrote: > > "for" looks good to a programmer. but "loop" might make more sense to > > a > > designer. > > > > {for ...} > > {/for} > > > > {loop var=$contacts} > > {/loop} > > > > > > I still think this adds unnecessary noise to the language. Why don't we > > change PHP's default delimiters from <? ?> to { } and be done with it? > > Because we need a way to loop through non-sequential/associative arrays, > and {section..} doesn't cut it. > > -Andrei > > "The most exciting phrase to hear in science, the one that heralds new > discoveries, is not "Eureka!" but "That's funny..." -- Isaac Asimov. > > --- > 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 (#1976) next »