> <table ...>
> [% FOREACH method IN all_methods %]
> [% '<tr>' IF loop.count % 2 == 1 %]
> <td> <input type="radio" name="method" value="[%
> method.id %]"> </td>
> <td> [% method.rate %] </td>
> <td> [% method.name %] </td>
> [% '</tr>' IF loop.count % 2 == 0 %]
> [% END %]
> </table>
>
> So, in that instance, I think having an "odd" (and an "even", natch)
> would make it more legible for the non-programmers.
I can think of a few ways. This one's simple:
<table ...>
[% FOREACH method IN all_methods; odd = loop.count % 2 %]
[% '<tr>' IF odd %]
<td> <input ... value="[% method.id %]"> </td>
<td> [% method.rate %] </td>
<td> [% method.name %] </td>
[% '</tr>' IF NOT odd %]
[% END %]
</table>
Using the aforementioned Template::Plugin::Cycle, you could do this:
<table ...>
[% FOREACH method IN all_methods %]
[% begin_tr %]
<td> <input ... value="[% method.id %]"> </td>
<td> [% method.rate %] </td>
<td> [% method.name %] </td>
[% end_tr %]
[% END %]
</table>
where begin_tr alternates ("<tr>", "") and end_tr alternates ("", "</tr>").
Or you could even just use one cycler:
<table ...>
[% FOREACH method IN all_methods %]
[% tr %]
<td> <input ... value="[% method.id %]"> </td>
<td> [% method.rate %] </td>
<td> [% method.name %] </td>
[% tr %]
[% END %]
</table>
where tr alternates ("<tr>", "", "", "</tr>").
Also, you could use a WRAPPER for the row that hides the sleight-of-hand
somewhere else.
- Mark.
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates