<dtml-if> and <dtml-var> question
First, thanks for the help these last several days. I'm glad to report that I have a useful Zope site up and running that is the envy of the law firm. Now its time to get a little fancy. Unfortunately, after having read the DTML Reference, and the Zope Quick Reference, I still haven't been able to figure out how to get today's date into a dtml-var. Case in point: I want to put a table of dates and hyperlinks. If the day has already passed, I want to shade the table cell (<td bgcolor="gray">). In this case, the object has a date property called event_date. <table> <tr> <dtml-if expr="event_date < DateTime()"> <td bgcolor="gray"> <dtml-else> <td bgcolor="white"> </dtml-if> </td> </table> The above code gives me a NameError. Another example would be to simply get the integer value of the year so that it can be included in a copyright statement. E.g., Copyright © <dtml-var Year()>, All rights reserved. Unfortunately, this doesn't work either. Can someone point me in the right direction?
Hi there, I've been having problems with DateTimes as well. My colleague and I (using Zope 201) found a problem with the module that causes any dbase timestamp to be rendered to a non-standard UNIX time that has an annoying DST appended if in the Daylight savings time zone, thus leaving the timestamp as useless when performing expressions against it. In our situation we used a scan from pos 0-29 to trap the proper timestamp syntax. Then from there, I use an expression as follows: <dtml-elif "list=='LI3'"> <dtml-call "REQUEST.set('timenow', (_.DateTime() - 30).Date())"> <dtml-in getMailLIC> <dtml-call "REQUEST.set('timethen', _.DateTime(transaction_date[0:27]).Date())"> <dtml-if "timethen==timenow"> <dtml-var buildMailList> </dtml-if> </dtml-in> </dtml-if> This is just a small part of the code, and im sure there is a better way, but hey, it works. Dont know if this helps you, but perhaps will give you an idea.... Cheers, -- Paz Oratrix Development BV http://www.oratrix.com GRiNS SMIL Editor -
participants (2)
-
complaw@hal-pc.org -
Paul Zwarts