Re: Sv: Re: New looping method proposal

From: Date: Tue, 20 Nov 2001 22:12:39 +0000
Subject: Re: Sv: Re: New looping method proposal
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-1991@lists.php.net to get a copy of this message
On Mon, 19 Nov 2001, anders.janson@mailbox.swipnet.se wrote: > OK, since it would actually solve a problem, I'll join the gang, and say "yes" > to this proposed addition. > > I suggest you use the same structure for parameters as you have today, and reuse the parser > code. Perhaps even parts of the code generator could be recycled? > > I noticed that "loop" was suggested as tag name, so here goes.... > > {loop name=whatever source=$my_array} > {$whatever.field1}<br> > {$whatever.field2}<br> > {/loop} > > Other tag names could be "repeat", "iterate" or "sequence" > ("seq"??). > > I'll get flames for this, but I don't believe in different syntax for > different tags. Existing Smarty tags are built like {tag key1=value1 > [keyN=valueN]}, and I vote for keeping it like this. The one I like so far is something like: {loop source=$array as=$element} {/loop} However, this doesn't account for the fact that you might want to access the array keys as well. Any suggestions? -Andrei "Everything should be made as simple as possible, but not simpler." -- Albert Einstein

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