Re: [Zope-dev] dtml-in with objects and an expression
Guy Redwood writes:
I have a stack of objects called shcgbRallyDetails (details about husky races). I want to display the next 3 races that are about to close their entry submissions. eg display the next three rally details where the closingdate is greater_or_equal to ZopeTime()
I've got this working to prove the expression and dtml-in - but I'm now stuck :-(
<dtml-in "working.rallydetails.objectValues(['shcgbRallyDetails'])" sort=closingdate> <dtml-unless "closingdate <=ZopeTime()"> <A HREF="<dtml-var absolute_url>"><dtml-var shortname></a><BR><br> Closing: <dtml-var closingdate </dtml-unless> </dtml-in>
All help would be appreciated What does not work?
You may get more than 3 races? In this case, you could use: <dtml-in .... sort=closingdate reverse> <!-- this sorts with latest closingdate first --> <dtml-if "closingdate > ZopeTime() and _.getitem('sequence-number') <= 3"> .... your presentation code .... </dtml-if> </dtml-in> This will give you the list sorted with decreasing closingdate. If you want a list sorted with increasing closingdate, you could use: <dtml-in .... sort=closingdate> <dtml-if "closingdate > ZopeTime() and (_.getitem('sequence-length') - _.getitem('sequence-index')) <=3"> .... your presentation code .... </dtml-if> </dtml-in> For more details, look at the variable list defined inside <dtml-in>. Dieter
participants (1)
-
Dieter Maurer