[Zope] Nesting question getting warmer

Alexander Staubo alex@mop.no
Thu, 30 Sep 1999 19:10:03 +0200


> Alexander,
> 
> thanx again for your help.
> 
> <dtml-var "PARENTS[0][PARENTS[0].id +'_' + PARENTS[1].id + '_p1']">
> 
> is the right idea, but for some reason it's just quoting the HTML....I
> must admit I'm curious to know why the "PARENTS[0]" is used twice.

In order to find the document _object_, we must go through PARENTS[0]'s
child dictionary mechanism -- which is what we do above.

The quoted HTML is correct. In order to render the object, iirc the
syntax is:

<dtml-var "_.getitem(PARENTS[0].id +'_' + PARENTS[1].id + '_p1', 1)">

> <dtml-var "PARENTS[0].id +'_' + PARENTS[1].id + '_p1'">
> 
> seemed to make more sense to me, but it just returned the string that
> needed to be replaced.

...exactly.

> I'd also managed to get the same result (sting, no substitution) with
> 
> <dtml-with id>
>   <dtml-var "id+'_'"><dtml-var "PARENTS[1].id+'_p1'">
> </dtml-with>
> 
> Although I have no idea what difference the "id" in the 
> <dtml-with id> makes.

Here you're just obtaining the name. That isn't what you're looking for.

As somebody else pointed out, this nesting thing may not be good design.
I'm fairly sure the person is correct -- difficult to say since you have
not told us in detail what you're trying to attain -- but I also like to
think that failing is a great way to learn. *wink*

> 
> Thanx again,
> Chris
> 

-- 
Alexander Staubo             http://www.mop.no/~alex/
"`Ford, you're turning into a penguin. Stop it.'"
--Douglas Adams, _The Hitchhiker's Guide to the Galaxy_