changing the default index_html
How do I do this? (I want to put in something like: <ul> <dtml-in "PARENTS[0].objectValues()"> <dtml-if expr="id=='index_html'"> <dtml-else> <li><a href="<dtml-var absolute_url>"><dtml-var id></a></li> </dtml-if> <dtml-else> Nothing in folder. </dtml-in> </ul> ) -- Maarten Slaets Web Developer KPNQwest Belgium http://www.fonky.com/vcard/MaartenSlaets/
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Maarten Slaets Sent: Tuesday, December 14, 1999 10:58 AM To: zope@zope.org Subject: [Zope] changing the default index_html
How do I do this?
(I want to put in something like: <ul> <dtml-in "PARENTS[0].objectValues()"> <dtml-if expr="id=='index_html'"> <dtml-else> <li><a href="<dtml-var absolute_url>"><dtml-var id></a></li> </dtml-if> <dtml-else> Nothing in folder. </dtml-in> </ul> )
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> (If no objectValues display 'Nothing in folder' else only shows all objectValues except index_html) Or do you want something else? Rik
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'"> ... thanks -- Maarten Slaets Web Developer KPNQwest Belgium http://www.fonky.com/vcard/MaartenSlaets/
-----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
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
ouch, you've been busy ;-) this is of much help, not in the least educationally! bedankt -- Maarten Slaets Web Developer KPNQwest Belgium http://www.fonky.com/vcard/MaartenSlaets/
<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>
Try this: <dtml-in expr="PARENTS[0].objectValues()" sort=id> <dtml-if sequence-start><ul></dtml-if> <dtml-if expr="_['id'] <> 'index_html'"> <li><a href="&dtml-absolute_url;">&dtml-id;</a></li> </dtml-if> <dtml-if sequence-end></ul></dtml-if> <dtml-else> Nothing in folder. </dtml-in> Cheers, Evan @ 4-am
participants (3)
-
Evan Simpson -
Maarten Slaets -
Rik Hoekstra