[Zope] [ZDP] Tree FAQs
Martijn Pieters
mj@antraciet.nl
Wed, 03 Mar 1999 16:58:14 +0100
My two cents on the tree tag:
* How do I tell the tree tag to show only Folders?
By using the objectValues function in the branches_expr attribute of
the tree tag. The objectValues function of a folder returns all objects
contained by that folder.
You can however, specify a list of object metatypes that it should
return. objectValues(['DTML Document']) will only return all DTML
Document objects in a Folder. Other metatypes you could select on are:
Folder, DTML Method, File, Image, Mail Host, User Folder and Session.
This is not a complete list, as Products can and will define their own
metatypes. If you want to show more types, just add them to the list,
like objValues(['Image', 'File']).
Example of a Folder tree (with links to them)::
<!--#tree branches_expr="objectValues(['Folder'])"-->
<A HREF="<!--#var URL1-->/<!--#var id-->">
<!--#var title_or_id-->
</A>
<!--#/tree-->
* How can I collapse or expand a tree using a URL?
The tree tag will show a tree fully expanded when the 'expand_all'
variable is present in its namespace. So when a URL, showing a tree, is
called with ?expand_all=1, the tree tag will expand all it's branches.
Collapsing can be achieved with collapse_all.
The following example shows a tree with collapse and expand 'buttons'::
<A HREF="<!--#var URL0-->?expand_all=1">
Expand all</A>|
<A HREF="<!--#var URL0-->?collapse_all=1">
Collapse all</A>
<!--#tree--><!--#var id--><!--#/tree-->
* How can I limit a tree to showing only *one* branch at a time?
Use the 'single' attribute for your tree, like in::
<!--#tree single--><!--#var id--><!--#/tree-->
More cents will follow.
Martijn
--
M.J. Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-6254545 Fax: +31-35-6254555
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------