[Zope] Nested dtml???

Tim Hicks Tim Hicks" <tim.hicks@iname.com
Wed, 30 Aug 2000 01:48:48 +0100


----- Original Message -----
From: "Dieter Maurer" <dieter@handshake.de>
To: "Tim Hicks" <tim.hicks@iname.com>
Cc: "zope" <zope@zope.org>
Sent: Tuesday, August 29, 2000 11:10 PM
Subject: Re: [Zope] Nested dtml???


> Tim Hicks writes:
>  > I am trying to work my way up through folders, checking whether
each
>  > folder has a property named 'site_root_folder'.  Logically (in
*my*
>  > head anyway), what I have written below is what I want to do, but
I'm
>  > not sure that I'm really writing this the write way.  I vaguely
>  > remember reading that I can't nest dtml-if tags within dtml-in
tags.
> There is no problem whatsoever to use "dtml-if" inside "dtml-in".
>
>  > <dtml-let level=0>
>  > <dtml-in level>
>  > <dtml-if "PARENTS[level].hasProperty('site_root_folder')">
>  > <dtml-var "PARENTS[level].absolute_url()">
>  > <dtml-else level="level+1">
>  > </dtml-in>
>  > </dtml-let>
> "dtml-in" works with sequences.
>
> In your example, however, you give it an integer ("level").
> It will not be happy with this.
>
> You may try:
>
> <dtml-in PARENTS>
>   <dtml-let PARENT="_.getitem('sequence-item')">
>     <dtml-if "PARENT.hasProperty....>
>     ....
>

Excellent.  Here is what I have managed to make work.

<dtml-in PARENTS>
<dtml-let PARENT="_.getitem('sequence-item')">
<dtml-if "PARENT.hasProperty('site_root_folder')"><dtml-var
"PARENT.absolute_url()"></dtml-if>
</dtml-let>
</dtml-in>

I really appreciate it.  And thanks for the reply on my other
(related) post.  Don't think I'll mess with ZopeFind for now; I don't
always have access to Zope 2.2.x, but more usually 2.1.6.

Thanks again.

tim