[Zope] How to call a method on another object in DTML
Max M
maxm@mxm.dk
Mon, 17 Mar 2003 13:19:59 +0100
pieter claassen wrote:
>I am trying to render the index_html method of another object in a new
>"wrapper" object.
>
>Normally you just do a <dtml-var object> and Zope will find the object.
>
>But what if the object is far away in another hierarchy and I want to
>render it (not call its index_html method on my object!)
>
>
It is a bit unclear what you are trying to do. But to get to the object,
you need a path to it. Just use the first objectManager that they both
share as the root.
<dtml-var "path.to.some.object.index_html()">
To give it a new context, you can pass it "this()" as an argument ( a
"mapping dictionary")
<dtml-var "path.to.some.object.index_html(this())">
You can even hand it some named parameters also:
<dtml-var "path.to.some.object.index_html(this(), title_or_id='Some
New Title')">
The values in the dtml page will be looked up in this order:
named parameters -> mapping dictionary -> the objects original context
regards Max M