Re: Sv: Re: New looping method proposal
| From: | Thies C. Arntzen | Date: | Wed, 21 Nov 2001 07:13:18 +0000 |
| Subject: | Re: Sv: Re: New looping method proposal | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-1993@lists.php.net to get a copy of this message | ||
On Tue, Nov 20, 2001 at 04:12:39PM -0600, Andrei Zmievski wrote:
> 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 source=$array as=$element using=$index}
{loop source=$array as=$element indexed_by=$index}
{loop source=$array as=$element thiesomannblabla=$index}
something along those lines would be cool.
tc