>>>>> "David" == David B Bitton <[EMAIL PROTECTED]> writes:

David> In case anyone would like to know how to implement alternating row colors in
David> a table using TT2, this is how:

David> [%- FOREACH object_id = objects.keys -%]
David>     <tr class="cell[% loop.count() % 2 %]">
David>         <td>foo</td>
David>     </tr>
David> [%- END -%]

David> and then all you have to do is implement two CSS style classes named cell1
David> and cell0 with your different colors.

Or, if you want to do it with inline colors or arbitrary CSS styles:

    [%- colors = [ '#dddddd', '#ffffff' ];
      FOREACH object_id = objects.keys;
    -%]
      <tr bgcolor="[% colors.${loop.count % 2} %]">
        <td>[% object_id; " = "; objects.$object_id; %]</td>
      </tr>
    [%- END -%]

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


Reply via email to