[Zope] tree tag: how to find out if a folder is a leave

Martijn Pieters mj@antraciet.nl
Wed, 18 Aug 1999 14:43:43 +0200


At 13:50 18/08/99 , Heiko Stoermer wrote:
>Hi Zopsters,
>I need to build a navigation tree that has has only the leaf-folders
>hyperlinked.
>(Two frame design: left frame navigation, right frame some kind of
>property page, but only for the folders that are leaves in the tree.)
>
>so: in the tree tag, how do I find out whether an element is a leaf or
>not?
>
>Any kind of help is extremely welcome.

Right now, no special variable is set to inform you wether or not an item 
has sub items. The only way to discover wether or not there are subitems, 
is by calling the same method as the tree tag calls to determine the 
children of the current node, and see if it returns anything.

So, supposing you do a tree of your Folder objects:

<dtml-tree branches_expr="objectValues('Folder')">
</dtml-tree>

Then you could test on "objectValues('Folder')":

<dtml-unless "objectValues('Folder')">
    This is a leaf, so make a hyperlink!
</dtml-unless>

--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-7502100 Fax: +31-35-7502111
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------