[Zope] Alternating Cols or Colors

Stephan Richter srichter@cbu.edu
Tue, 21 Mar 2000 19:23:20 -0600


At 05:29 PM 3/21/00 -0700, you wrote:
>Does anyone know an elegant way (or a way at all) to alternate what
>color rows in a table are or to alternate which column a cell is on?

Sure, I do it all the time. The following way is the fastest I came up with:

- Create a style sheet that looks like that:

// even rows
td.listrow1 {
       color:        blue;
}

// odd rows
td.listrow0 {
       color:        white;
}

Then write a DTML method/document (for example displaying objects in a folder):

<table>

<dtml-in "objectValues()">
   <tr>
       <td class="listrow&dtml-sequence-even;">
           <dtml-var title_or_id>
       </td>
    </tr>
</dtml-in>

</table>

sequence-even returns a boolean  set true (1) when we have an even row.

This is untested code, but should work.

Regards,
Stephan
--
Stephan Richter - (901) 573-3308 - srichter@cbu.edu
CBU - Physics & Chemistry; Framework Web - Web Design & Development
PGP Key: 735E C61E 5C64 F430 4F9C 798E DCA2 07E3 E42B 5391