Subject: Re: [Zope] inelegant repetition of ZPT code
From: Andre Meyer <a.meyer@hccnet.nl>
To: Andreas Jung <lists@andreas-jung.com>
In-Reply-To: <2147483647.1069797757@[192.168.0.101]>
References: <1069793571.3443.20.camel@localhost.localdomain>
	<2147483647.1069797757@[192.168.0.101]>
Content-Type: text/plain
Message-Id: <1069796769.3443.44.camel@localhost.localdomain>
Mime-Version: 1.0
X-Mailer: Ximian Evolution 1.4.5 (1.4.5-7) 
Date: Tue, 25 Nov 2003 22:46:09 +0100
Content-Transfer-Encoding: 7bit

Cool, thanks! That's where an expert distinguishes himself from a
newbie.

Just some typos: it works like this:
<tr tal:attributes="bgcolor python:test(repeat['item'].even(), 'white',
'lightgray')">

On Tue, 2003-11-25 at 22:02, Andreas Jung wrote:
> what's wrong with
> 
> <untested>
> 
> <tr tal:attributes="bgcolor python: test(repeat['item'].odd, 'white', 
> 'lightgray'" />
> 
> </untested>
> 
> -aj
> 
> --On Dienstag, 25. November 2003 21:52 Uhr +0100 Andre Meyer 
> <a.meyer@hccnet.nl> wrote:
> 
> > Hi Zopers
> >
> > Another detail that bugs me: how can I translate the following dtml code
> > to zpt. It colours table rows in grey/white alternatively. Is the zpt
> > version below the only way? It is clearly very inelegant to repeat code.
> >
> >
> > DTML
> >
> > ...
> > <table>
> >     <dtml-in listItems>
> >         <tr <dtml-if sequence-even>bgcolor="lightgray"</dtml-if>>
> >             <td>...</td>
> >         </tr>
> >     </dtml-in>
> > </table>
> >
> >
> > ZPT
> >
> > ...
> > <table>
> >     <span tal:repeat="item here/listItems">
> >         <tr bgcolor="white" tal:condition="repeat/item/even">
> >             <td>...</td>
> >         </tr>
> > 	<tr bgcolor="lightgray" tal:condition="repeat/item/odd">
> >             <td>...</td>
> >         </tr>
> >     </span>
> > </table>
> >
> >
> > thanks and best wishes
> > Andre
> >
> >
> >
> > _______________________________________________
> > Zope maillist  -  Zope@zope.org
> > http://mail.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists -
> >  http://mail.zope.org/mailman/listinfo/zope-announce
> >  http://mail.zope.org/mailman/listinfo/zope-dev )
> 
> 
> 
> 
