The documentation that I've been able to find suggests that if I want to do alternate-row shading for a table, I should do the following: <table> <tbody tal:repeat="item container/objectValues"> <tr bgcolor="#EEEEEE" tal:condition="repeat/item/even"> <td tal:content="repeat/item/number">#</td> <td tal:content="item/id">Id</td> <td tal:content="item/meta_type">Meta-Type</td> <td tal:content="item/title">Title</td> </tr> <tr tal:condition="repeat/item/odd"> <td tal:content="repeat/item/number">#</td> <td tal:content="item/id">Id</td> <td tal:content="item/meta_type">Meta-Type</td> <td tal:content="item/title">Title</td> </tr> </tbody> </table> This is all fine and dandy until the number of columns gets big and the code to generate them gets complicated. Since all of the TDs are duplicated, you end up maintaining the same code twice. It was simpler in DTML when I could do: ... <tr<dtml-if sequence_even> bgcolor="#EEEEEE"</dtml-if>> ... and not duplicate the whole block of TDs. I think I've found a way to make it work similarly using ZPT, but it's a hack at best, and it's very ugly: <table> <tr tal:repeat="item container/objectValues" tal:attributes="bgcolor python:(repeat['item'].even() and '#EEEEEE') or None"> <td tal:content="repeat/item/number">#</td> <td tal:content="item/id">Id</td> <td tal:content="item/meta_type">Meta-Type</td> <td tal:content="item/title">Title</td> </tr> </table> I'd say this is still better than duplicated code. I've been doing this ZPT stuff for all of two days now. Is there a better way to do this?
On Wed, Jun 09, 2004 at 05:31:40PM -0600, Steve Jibson wrote:
I think I've found a way to make it work similarly using ZPT, but it's a hack at best, and it's very ugly:
<table> <tr tal:repeat="item container/objectValues" tal:attributes="bgcolor python:(repeat['item'].even() and '#EEEEEE') or None"> <td tal:content="repeat/item/number">#</td> (snip)
FYI, I've recently been using a slight variant of this technique. <span tal:omit-tag="" tal:repeat="item container/objectValues"> <tr style="background-color: #EEEEEE" tal:define="do_shade repeat/item/even" tal:attributes="style python:do_shade and default or None"> ... -- Paul Winkler http://www.slinkp.com
Hi, sorry if this is the wrong list for this question, but I am looking for a zope hosting provider. Can anyone recommend a US based company that offers a shared Zope server? Please send price info. -thanks, josh z __________________________________ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/
anyone recommend a US based company that offers a shared Zope server? Please send price info.
http://www.zettai.net/ZopeHosting/Basic Annual Cost $120 ($10/month) Quarterly Cost $36 ($12/month) http://www.zettai.net/ZopeHosting/Webmaster Annual Cost $390 ($33/month) Monthly Cost $39/month They're great. -- Jean Jordaan http://www.upfrontsystems.co.za
On Wed, Jun 09, 2004 at 08:00:47PM -0700, josh zeidner wrote:
Hi,
sorry if this is the wrong list for this question, but I am looking for a zope hosting provider. Can anyone recommend a US based company that offers a shared Zope server? Please send price info.
I've had good results with both interlix and hurrah, depending on what package works for your needs. -- Paul Winkler http://www.slinkp.com
participants (4)
-
Jean Jordaan -
josh zeidner -
Paul Winkler -
Steve Jibson