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? A less-than-elegant solution would be to somehow assign a variable 1, check and see if it's on 1, show one color, set it to 2, show the second color, etc... But I'm not sure what I'm doing wrong with dtml-let to do that: <dtml-let c="1"></dtml-let> .. ? -- Ken Kinder 303.381.7631
Ken Kinder 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?
<dtml-in stuff> <tr bgcolor="<dtml-if sequence-even>#000000<dtml-else>#FFFFFF</dtml-if>"> <td><dtml-var sequence-item></td> </tr> </dtml-in> -- Nick Garcia | ngarcia@codeit.com CodeIt Computing | http://codeit.com
On Wed, 22 Mar 2000, Ken Kinder 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?
A less-than-elegant solution would be to somehow assign a variable 1, check and see if it's on 1, show one color, set it to 2, show the second color, etc... But I'm not sure what I'm doing wrong with dtml-let to do that:
<dtml-let c="1"></dtml-let> ..
If you are doing this inside a <dtml-in> tag, you can use the sequence-id-odd and sequence-id-even vars, thus: <dtml-in someSequence> <dtml-if sequence-id-odd> <tr bgcolor="blue"> <dtml-else> <tr bgcolor="red"> </dtml-if> <td> some stuff here</td> </tr> </dtml-in> -- Have a better one, Curtis. <dtml-var standard_work_disclaimer>
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
participants (4)
-
Curtis Maloney -
Ken Kinder -
Nick Garcia -
Stephan Richter