Complex dtml-in/ZopeFind ?
Hi, I have the following code now: <dtml-in "subdir.objectValues('DTML Document')" sort=bobobase_modification_time reverse> <dtml-if sequence-start> <tr><th>bla</th></tr> <tr><td> </dtml-if> <dtml-if "(startdate <= _.DateTime()) & (_.DateTime() <= enddate)"> <h2><dtml-var title></h2> <dtml-var sequence-item> </dtml-if> <dtml-if sequence-end> </td></tr> </dtml-if> </dtml-in> the problem here is that the sequence-start/end will always be executed - for the case that there is an object outside of the start/end date window! So I have to move the if (startdate <= _.DateTime()) & (_.DateTime() <= enddate) condition into the dtml-in .... Or replace thedtml-in with ZopeFind or something else .... Is it possible to but everything I need into a dtml-in or a ZopeFind? As it looks to me - I can not add the if condition to the dtml-in - on the other hand I don't see how to sort the result of an ZopeFind ... But hopefully I am still a little blind and someone can help - Thanks Kai -- Institut für Seeverkehrswirtschaft und Logistik http://www.isl.org/ Dipl.-Inform. Kai Hofmann mailto:hofmann@isl.org Universitaetsallee GW1 Block A phone:+49 421 22096-83 D-28359 Bremen fax:+49 421 22096-55
Hi Kai, thats simple. You have too much logic in your dtml. First of all I would do it rather with a zcatalog search, since this would not call all documents (e.g. load them into memory) and gives you the flexibility on choosing whatever subset you want. If not, you should put all your search stuff into a python script, which returns a list of only the objects you want. If you use query-start/end you could as well put the <table> </table> stuff there as well. If you dont, you can drop these lines and put them all outside, so there is no need to see how many items are returned. HTH Tino Wildenhain --On Donnerstag, 3. Mai 2001 11:27 +0200 Kai Hofmann <hofmann@isl.org> wrote:
Hi,
I have the following code now:
<dtml-in "subdir.objectValues('DTML Document')" sort=bobobase_modification_time reverse> <dtml-if sequence-start> <tr><th>bla</th></tr> <tr><td> </dtml-if> <dtml-if "(startdate <= _.DateTime()) & (_.DateTime() <= enddate)"> <h2><dtml-var title></h2> <dtml-var sequence-item> </dtml-if> <dtml-if sequence-end> </td></tr> </dtml-if> </dtml-in>
the problem here is that the sequence-start/end will always be executed - for the case that there is an object outside of the start/end date window! So I have to move the if (startdate <= _.DateTime()) & (_.DateTime() <= enddate) condition into the dtml-in .... Or replace thedtml-in with ZopeFind or something else ....
Is it possible to but everything I need into a dtml-in or a ZopeFind? As it looks to me - I can not add the if condition to the dtml-in - on the other hand I don't see how to sort the result of an ZopeFind ...
But hopefully I am still a little blind and someone can help - Thanks
Kai
-- Institut für Seeverkehrswirtschaft und Logistik http://www.isl.org/ Dipl.-Inform. Kai Hofmann mailto:hofmann@isl.org Universitaetsallee GW1 Block A phone:+49 421 22096-83 D-28359 Bremen fax:+49 421 22096-55
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (2)
-
Kai Hofmann -
Tino Wildenhain