[Zope] Alt color in table.

Tommy Johnson tommy@7x.com
Tue, 12 Jun 2001 15:10:21 -0800


> hi,
>
> Works great, can you explane the syntax in the dtml-if statment?
>
> What does the all the pucntuation do?
>
> Thanks,
> j.
>

Ok, let's break it into parts:

***** ['sequence-odd'] *****

Ok, you have a list of items. You want to have a gray background for
alternating items when you list them out. An easy way to do this is to color
the background of all EVEN numbered items or all ODD number items. Your
choice. But that this bit of code is saying is --> in this particular
sequence of items, if the sequence number is odd...

When using it in this way, it will return 'True' if the index of the current
item is odd. Therefore, this block of the dtml-if tag is executed.


Now for the underscore:

***** _ *****

This is a special variable that allows you to explicitly access a variable
in the DTML namespace. Therefore, _[x] will give you the object of which the
name is given by x.


Hope this helps,
Tommy