[Zope] Calling dtml methods in others folders

Johan Carlsson johanc@torped.se
Mon, 18 Oct 1999 19:08:48 +0200


> 
> Reply-To: 
> I have the following DTMl file "func_dtml" in a Zope folder "functions":
> 
> <h2><dtml-var rubrik></h2>
> 
> Why can't I call in the parent folder within a DTML document 
> something like:
> 
> <dtml-var "functions/func_dtml(rubrik='test')">
> 
> Is it in any case forbidden to call dtml methods in other
> folders ?

You use the aqcusition feature to access parent 
folders and the <dtml-with> to climb up the tree.

If "functions" folder are directly in a parent folder from
where you are calling:

  <dtml-with "functions">
      <dtml-var "func_dtml(rubrik='test')">
  </dtml-with>

If "functions" folder are in another bransch use <dtml-with>
to climb:

  <dtml-with "functions">
	<dtml-with "tt2">
      	<dtml-var "func_dtml(rubrik='test')">
      </dtml-with>
  </dtml-with>

or you can use direct object referens:

case 1:
<dtml-var "functions.func_dtml(rubrik='test')">

case 2:
<dtml-var "functions.tt2.func_dtml(rubrik='test')">

The <dtml-with> tag is powerful because you can change
the namespace (eg. "location") so that you can access
many different method and properties from that
posision.

Exempel:
  <dtml-with "functions">
	<dtml-with "tt2">
            <dtml-var "title_or_id">
		<dtml-var "func_dtml(rubrik='test')">
      	<dtml-var "func2_dtml(rubrik='test2')">
      </dtml-with>
  </dtml-with>

//johan