[Zope] Different row colors

Meilicke, Scott scott.meilicke@intp.com
Mon, 1 Oct 2001 13:26:32 -0700


I'm guessing what is happening is the <dtml-in ebird> is creating a list,
then the <dtml-if "end_date > ZopeTime()...> bit is filtering out some of
your entries, causing evens and odds to be next to each other.  While I
haven't done this, you may be able to build your list based off of your
<dtml-if> criteria and store it in another, then display based on the new
list using a fresh <dtml-in> statement.

Here's an example from: http://www.zope.org/Members/lstaffor/Breadcrumbs.

It filters out stuff that the user isn't authorized to see, puts that into a
list (rev), then iterates over the list. 

<!-- start Breadcrumbs -->
<dtml-call "REQUEST.set('rev', [])">
<dtml-in PARENTS skip_unauthorized>
<dtml-let item=sequence-item>
<dtml-call "rev.insert(0, item)">
</dtml-let>
</dtml-in>
<dtml-in rev>
<dtml-with sequence-item>
<a href="<dtml-var absolute_url>">
<dtml-if "hasProperty('nickname')"><dtml-var nickname><dtml-else><dtml-var
title_or_id></dtml-if></a>
</dtml-with>
<dtml-unless sequence-end>&nbsp;&gt;&nbsp;
</dtml-unless>
</dtml-in>
<!-- end Breadcrumbs -->

Scott

-----Original Message-----
From: Todd Loomis [mailto:tloomis@dmso.mil]
Sent: Monday, October 01, 2001 12:53 PM
To: zope@zope.org
Subject: [Zope] Different row colors


All:

I'm trying to create two different background colors for my rows. Here is 
what I'm currently using:

<dtml-var standard_html_header>
<h2>News Briefs</h2>
<table cellpadding="5" cellspacing="0" border="0" width="100%">
<dtml-with "ebird">
<dtml-in "objectValues('Ebird')" sort=display_order>
<dtml-if expr="end_date > ZopeTime() and start_date <= ZopeTime()">
<dtml-if sequence-even>
<tr>
<td class="whitebody"><a href="ebird/<dtml-var id>"><dtml-var
title></a></td>
</tr>
<dtml-else>
<tr>
<td class="graybody"><a href="ebird/<dtml-var id>"><dtml-var title></a></td>
</tr>
</dtml-if>
</dtml-if>
</dtml-in>
</dtml-with>
</table>
<dtml-var standard_html_footer>

But this seems to group some of the backgrounds together when I want to 
have every other row a different color (white, gray). Can this be done 
another way?

Thanks,
Todd


_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )