[Zope] DTML-TREE

Chris Withers chrisw@nipltd.com
Wed, 19 Apr 2000 14:35:30 +0100


> I don't define myobject. My tree searches certain classes. :
> 
> <dtml-tree branches_expr="objectValues['MyClass']">
> </dtml-tree>
> 
> This code is defined in the index_html of a container class.

Right, this code has no 'name' specified, so dtml-tree uses the current object. This will be
index_html if index_html is a dtml document, or its container if it's a method.

> So in order to use the 'if' statement, I would need a way to say : 'if a
> class exists of this type then, otherwise do..'. How can I handle this?

Actually, <dtml-if "this()"> will probably do it, but I haven't tested it.

If your branches expression doesn't return anything, then you should get a tree root with no
branches.

Now, if you don't want to display a tree for an object unless it is going to have branches, then you
want to wrap your dtml-tree in something like:

<if "objectValues['MyClass']">

cheers,

Chris