NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Re: Template Toolkit: Alternating row colors (Score:2)
Using loop.count instead of loop.index makes that code a little simpler (loop.count is always loop.index + 1).
[% FOREACH object = domain.raObject %] <tr [% IF not (loop.count % 3) %]bgcolor="#EEEEEE"[% END %]>Also, I'd tend to do something like this with classes and stylesheets as it makes it easier to change in the future.
[% FOREACH object = domain.raObject %] <tr class="row_style_[% loop.count % 3 %]">You can then define three (or less) styles called "row_style_0", "row_style_1
Re: Template Toolkit: Alternating row colors (Score:2)
-Dom
Re: Template Toolkit: Alternating row colors (Score:1)
Why would you want to include yet another js script when you can do the same thing in TT in a few lines of Perl? That is just crazy.
Then again I am retentive about controlling my code as much as possible. :-)
Reply to This
Parent