[Zope] Alternating Cols or Colors

Curtis Maloney curtis@umd.com.au
Wed, 22 Mar 2000 12:05:20 +1100


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>