[Zope] Even and odd db rows

Anthony Pfrunder s341625@student.uq.edu.au
Fri, 13 Aug 1999 10:11:12 +1000 (GMT+1000)


On Thu, 12 Aug 1999, Stephan Richter wrote:

> hey guys I am writing an application that displays all the members of my
> database. Since I want to list a minimum of 15 on one page I want to
> highlight every second one, so they can visually be seperated.
> 
> How would I do that?

You could use sequence-index in conjunction with if to insert the color of
the row.  Hence (untested):

<table>
# Set a variable for the processing of the page
<dtml-var REQUEST.set(counter,0)>

<in mysequence>

# Flip it between 0 & 1
<dtml-if counter=0>
	<dtml-var REQUEST.set(counter,1)>
<dtml-else>
	<dtml-var REQUEST.set(counter,0)>
</dtml-if>

<TR
# Insert a color based on state of counter
<dtml-if counter>
	color=0x1
<dtml-else>
	color=0x2
</dtml-if>
>
	mystuff in table row
</TR>
</in>
</table>

Cheers,

Anthony Pfrunder