-----Original Message----- From: Maarten Slaets [mailto:maarten.slaets@kpnqwest.com] Sent: Tuesday, December 14, 1999 12:15 PM To: Rik Hoekstra Cc: zope@zope.org Subject: Re: [Zope] changing the default index_html
hi Rik,
hm, it seems to me the dtml-if is not used properly. I'm not sure what you want,though. Would the next amended version work?
<ul> <dtml-in "PARENTS[0].objectValues()"> <dtml-if expr="id=='index_html'"> <li><a href="<dtml-var absolute_url>"><dtml-var id></a></li> <dtml-else> Nothing in folder. </dtml-if> </dtml-in> </ul>
(only shows index_html)
or this one: <ul> <dtml-if"expr=_.len(PARENTS[0].objectValues()==0"> Nothing in folder. <dtml-else> <dtml-in "PARENTS[0].objectValues()"> <dtml-if expr="id!='index_html'"> <li><a href="<dtml-var absolute_url>"><dtml-var id></a></li> </dtml-if> </dtml-in> </dtml-if> </ul>
yup the above is what I wanted. i have fixed some syntax: <ul> <dtml-if expr="_.len(PARENTS[0].objectValues())==0"> Nothing in folder. <dtml-else> <dtml-in "PARENTS[0].objectValues()"> <dtml-if expr="id!='index_html'"> <li><a href="<dtml-var absolute_url>"><dtml-var id></a></li> </dtml-if> </dtml-in> </dtml-if> </ul>
but it still shows the index_html. maybe I am comparing a string with an object in <dtml-if expr="id!='index_html'"> ...
Hi Maarten This nagged me, so I delved into it a bit more. It did not work as a result of mixing DTML Methods with proper objects. The id of the DTML Method is not a string (apparently), but of other objects it is. Or something like that (I don't really understand this) The resulting code is a bit more complicated than I'd have hoped for (well, it's not _that_ bad), but it works. If someone knows something cleaner - please tell us <ul> <dtml-if expr="_.len(PARENTS[0].objectItems())==0"> Nothing in folder. <dtml-else> <dtml-with "PARENTS[0]"> <dtml-in objectValues sort=id> <dtml-if "meta_type=='DTML Method'"> <dtml-if expr="id() <> 'index_html'"> <li><a href="<dtml-var absolute_url>"><dtml-var id></a></li> </dtml-if> <dtml-else> <dtml-if expr="id<>'index_html'"> <li><a href="<dtml-var absolute_url>"><dtml-var id></a></li> </dtml-if> </dtml-if> </dtml-in> </dtml-with> </dtml-if> </ul> Rik