On Wed, Oct 31, 2001 at 09:23:00AM -0500, Brett Sanger wrote:
> It's a modification to a foreach loop, such that if the loop condition
> NEVER happens, the ELSE path is taken. Often I'll find myself with a loop
> that might not happen, and I have to cover that alternative. Listing
> items in a list, for example:
>
> [% 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 %]
A