Re: [Zope] Building tables from a db in dtml...
-----Oorspronkelijk bericht----- Van: Martijn Pieters <mj@digicool.com> Aan: jiva@devware.com <jiva@devware.com>; zope@zope.org <zope@zope.org> Datum: zondag 27 februari 2000 10:57 Onderwerp: Re: [Zope] Building tables from a db in dtml... [snip]
(untested):
<table><tr> <dtml-in db_query> <dtml-if "_['count-value'] % 4 == 0"></tr><tr></dtml-if> <td><dtml-var value></td> </dtml-in> </tr></table>
Now, I could be wrong and count-value is 1 based in stead of 0 based. In fact, I believe it is, it would make sense anyway. Then you'd adjust the logic slightly, something like (_['count-value'] - 1) % 4.
Count-xxx does not change during the sequence, it simply gives the number of non-missing xxx-values in the sequence. Furthermore, refering to the response of Jim Sanford, the solution can do without integer or sting conversions: (tested!!!) <TABLE> <dtml-in objectValues> <TR><TD><dtml-var sequence-number></TD> <TD> <dtml-if "_['sequence-number']!=0 and _['sequence-number']%2==0">even <dtml-else> odd </dtml-if> </TD></TR> </dtml-in> </TABLE> cb
From: "Cornelis J. de Brabander" <brabander@fsw.leidenuniv.nl>
Now, I could be wrong and count-value is 1 based in stead of 0 based. In fact, I believe it is, it would make sense anyway. Then you'd adjust the logic slightly, something like (_['count-value'] - 1) % 4.
Count-xxx does not change during the sequence, it simply gives the number of non-missing xxx-values in the sequence. Furthermore, refering to the response of Jim Sanford, the solution can do without integer or sting conversions:
(tested!!!)
<TABLE> <dtml-in objectValues> <TR><TD><dtml-var sequence-number></TD> <TD> <dtml-if "_['sequence-number']!=0 and _['sequence-number']%2==0">even <dtml-else> odd </dtml-if> </TD></TR> </dtml-in> </TABLE>
Whoops. Thanks, Cornelis. -- Martijn Pieters | Software Engineer mailto:mj@digicool.com | Digital Creations http://www.digicool.com/ | Creators of Zope http://www.zope.org/ | The Open Source Web Application Server ---------------------------------------------
participants (2)
-
Cornelis J. de Brabander -
Martijn Pieters