[Zope] Newbie: dtml-unless
Casey Duncan
cduncan@kaivo.com
Mon, 12 Mar 2001 09:32:43 -0700
"M. Adam Kendall" wrote:
>
> First off, dtml-unless probably won't do you much
> good here unless it's actually within the dtml-in.
> Think about this. Where does 'id' come from?
>
> Second, by doing 'id' == 'standard_html_whatever'
> you are comparing two strings. Of course 'id' will
> never equal anything other than 'id'.
> So, something like this should work (untested):
>
> <dtml-in expr="foldername.objectValues()">
> <dtml-unless "id == 'standard_html_header'">
> <dtml-unless "id == 'standard_html_footer'">
> <a href="<dtml-var absolute_url>"><dtml-var id></a><br>
> </dtml-unless>
> </dtml-unless>
> </dtml-in>
>
> > I'd like to list the content of a folder, except if it is the
> > standard_html_header or footer. I use this code:
> >
> > <dtml-unless "'id' == 'standard_html_header'">
> > <dtml-unless "'id' == 'standard_html_footer'">
> > <dtml-in expr="foldername.objectValues()">
> > <a href="<dtml-var absolute_url>"><dtml-var id></a><br>
> > </dtml-in>
> > </dtml-unless>
> > </dtml-unless>
>
Furthermore, you will find accessing id in an expression to be
troublesome. For some objects it is an attribute, for others it is a
method. Use getId() in place of id. example:
<dtml-in name="objectValues">
<dtml-unless expr="getId() in
['standard_html_header','standard_html_footer','standard_error_message']">
...Some code...
</dtml-unless>
</dtml-in>
hth
--
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>