One option is to use the :even and :odd (iirc) selectors of CSS.
Another way is to have multiple patterns with the same name; the coresponding patternGenerator will then alternate between them. For example, if you have this template:
<table n:render='fu'> <tr n:pattern='item'><td>111</td></tr> <tr n:pattern='item'><td>222</td></tr> </table>
and this code:
def render_fu(self, context, data): pattern = context.patternGenerator('item') content = [pattern() for _ in xrange(4)] return context.tag.clear()[content]
you will get a table
111 222 111 222
render_sequence is a builtin renderer that works like this already. If you have some data in a sequence and each one outputs a row, render_sequence is probably what you want. The docstring is in rend.py; you can pydoc nevow.rend.sequence to see it.
On Mon, Aug 23, 2004 at 02:11:00PM -0400, angryhicKclown@netscape.net wrote:
If I have a table, and I want the background colors to alternate, how would I do that in Nevow?