handling date properties in <dtml-if>
Hi everyone, I've created a simple ZClass to allow our Human Resources dept. to post job openings on our Web site. There's a DTML method that iterates through a folder containing all of the 'Job Board Entry' instances and displays them in an HTML table. No problem there. The ZClass has a number of properties including two dates, 'date_posted' for the date that the job is officially available and 'offer_expires' for the date the job opening officially closes. I want to display only those jobs for which the current date is on or after the 'date_posted' and on or before 'offer_expires'. I've tried a bunch of things, but haven't hit upon the winning answer. Any takers? -Tim -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.k12.mn.us/ | http://www.zope.org/ W. St. Paul, MN | | http://slashdot.org/ wilson@visi.com | <dtml-var pithy_quote> | http://linux.com/
Hi,
... I want to display only those jobs for which the current date is on or after the 'date_posted' and on or before 'offer_expires'. I've tried a bunch of things, but haven't hit upon the winning answer. Any takers?
Try <dtml-in "objectValues('Jobs')" sort="date_posted"> <dtml-if "offer_expires.isFuture()"> <dtml-if "date_posted.isPast()"> Job: <dtml-var title> <br> </dtml-if> </dtml-if> </dtml-in> Seb.
Hi ! seb wrote:
Hi,
... I want to display only those jobs for which the current date is on or after the 'date_posted' and on or before 'offer_expires'. I've tried a bunch of things, but haven't hit upon the winning answer. Any takers?
Try
<dtml-in "objectValues('Jobs')" sort="date_posted"> <dtml-if "offer_expires.isFuture()"> <dtml-if "date_posted.isPast()"> Job: <dtml-var title> <br> </dtml-if> </dtml-if> </dtml-in>
I have added it to he ZSnippets: http://zdp.zope.org/projects/zsnippet/snippets/time/expiration Regards, Maik Röder -- Uzopia - Digging la vida Zopa - http://uzopia.editthispage.com
participants (3)
-
Maik Roeder -
seb -
Timothy Wilson