> > [% FOREACH Item = List %]
> >   Item [% loop.count %] [% Item %]
> > [% ELSE %]
> >   No items found
> > [% END %]
> I wonder if it might be better to have a new construct instead of FOREACH?

> For example, something like this (off the top of my head):
>   [% LOOP item = list %]
>      <tr><td>[% item %]</td></tr>
>   [% BEFORE %]
>      <table>
>   [% AFTER %]
>      </table>
>   [% EMPTY %]
>      There are no items in the list.
>   [% END %]

Yes, but this is equivalent to

    <table>
[% LOOP item = list %]
    <tr><td>[% item %]</td></tr>
[% EMPTY %]
    There are no items in the list.
[% END %]
    </table>

So, is it really interesting ?

And, in english, I can say something like  "I loop else".... [ not sot much,
after all  ;o) ]

So,

    <table>
[% LOOP item = list %]
    <tr><td>[% item %]</td></tr>
[% ELSE %]
  There are no items in the list.
[% END %]
    </table>

could be more readable.
Therefore, we can say that LOOP is an alias to FOREACH, and ELSE should be
added to the FOREACH construct.

kktos




Reply via email to