[Zope] dtml-in and if
Phil Harris
phil.harris@zope.co.uk
Wed, 22 Aug 2001 13:20:13 +0100
James,
Create a Script(Python) called news_filter that has these contents:
#---start of the filter
retval=3D[]
for a in objectValues(['Informatie', 'sitenieuws']):
if has_key(a.aq_explicit,'publish'):
retval.append(a)
return retval
#---end of filter
then in your dtml method:
<dtml-in news_filter start=3Dquery_start size=3D"6"
sort=3Dbobobase_modification_time reverse>
<dtml-var title>
</dtml-in>
caveat: all this is untested as it's written, but should give you some
ideas.
Phil
----- Original Message -----
From: "James van der Veen" <james@codenamefuture.nl>
To: <zope@zope.org>
Sent: Wednesday, August 22, 2001 12:39 PM
Subject: [Zope] dtml-in and if
> Hi everybody..
>
> I have a question...
>
> How should I do the folowing?
>
> I now have this
>
> <dtml-in "objectValues(['Informatie', 'sitenieuws'])" start=3Dquery_sta=
rt
> size=3D"6" sort=3Dbobobase_modification_time reverse>
> <dtml-if "publish=3D=3D'true'">
> <dtml-var title>
> </dtml-if>
> This means it wil find all the objects if the publish property is true.
> But here is my problem. If if I want 6 of the titles on my frontpage
> (size=3D6) it doesn=B4t work because the fist 6 it might find aren=B4t =
publish =3D
> true
> I guess the thing I would want to do is the above code but than with a
else
> bit that increases the sitze of the query if the publish property isn=B4=
t
> true.
> I guess it would look like this (tried this but doesn=B4t work)
>
> <dtml-in "objectValues(['Informatie', 'sitenieuws'])" start=3Dquery_sta=
rt
> size=3D"6" sort=3Dbobobase_modification_time reverse>
> <dtml-if "publish=3D=3D'true'">
> <dtml-var title>
> <dtml-else>
> <dtml-call "REQUEST.set('size', ['size' + '1'])">
> </dtml-if>
>
> Any clues on how to do this the right way...??
>
> Hope someone can help me on this one!!
>
> Greetz,
> James
>
> _______________________________________________
> 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 )