[Zope] dtml-tree info

Tino Wildenhain tino@wildenhain.de
Tue, 01 May 2001 02:22:45 +0200


Hi Robert,

I do this and I dont use the tree-tag at all anymore.
The trick is to organisate your site hierarchically.
I do only folder-like objects with one content-object
(or property or whatever).
So the site is simply a tree of folderobjects (not folder
itself but a subclass (or more then one subclass of it))
Then a simple method can render the navigation:
(lets call it navigation)
<table>
<dtml-in "objectValues('TheFolderClass')">
<dtml-if "sequence_item in PARENTS">
<tr><td>[-]</td><td>&dtml-title;<br>
           <dtml-var navigation></td></tr>
<dtml-else>
<tr><td>[+]</td><td><a 
href="&dtml-absolute_url;/">&dtml-title;</a></td></tr>
</dtml-if>
</dtml-in>

This is the very simple approach, you can make more
design if you want. The trick is "sequence_item in PARENTS"
which is true if the actual object is in your URL path.
This way the tree shows your current navigation without
bothering to save the treestate or bother the user with ugly
cookies and/or URLs.

I have to mention you must call this "navigation" method
inside a index_html method or something you let acquisite.
Call is there like that:

<dtml-with "PARENTS[-1]">
<dtml-var navigation>
</dtml-with>

To start the tree at the root.

Oh, you have to use "_['sequence-item'] ... " and stuff if
you dont use my dtml-in replacement.

HTH
Tino Wildenhain

--On Montag, 30. April 2001 20:37 +0200 Robert Segall <roseg@apsis.ch> 
wrote:

> Hope someone has already run into this: I need to be able to control
> the tree display state from dtml and I can't find any info on the
> subject.
>
> The "normal" tree display has the "+" (or "-") part, with its own
> URL that includes an encoded argument, and the user-defined part. At
> the very least I would like to be able to mimic the behaviour of the
> "+" by clicking on the "user" part (which I make into a link by
> myself). To make matters worse, this link may take me to another
> object (page).
>
> Ideally, I would like to be able to control the display behaviour -
> saying which branch(es) are to be shown open and which closed, and
> to which level, within the page itself.
>
> Any pointers would be greatly appreciated. Tnx,
>
> Robert
>
>
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )