[Zope] tree tag global navigation
Martijn Pieters
mj@atmm.nl
Tue, 23 Feb 1999 21:53:17 +0100
At 19:48 23-2-99 , Michael Bernstein wrote:
>Step 1: Create an external method with the following code:
>
>def getFoldersOnly(self):
> """Return a list of only the Folders contained in an
> object, for use by the tree tag"""
> return self.objectValues(['Folder'])
>
>This is neccesary in order to avoid listing the product and acl_users
>folder objects. Thanks to Kent Polk for the code. Modify this code if
>you want to display something other than just folders, For example:
>
>
>Step 2: Create a DTML method named SideBar in your root folder with the
>following code:
>
><!--#tree branches=getFoldersOnly-->
><A HREF="<!--#var BASE1-->/<!--#var tree-item-url-->"><!--#var id--></A>
><!--#/tree-->
>
You can skip the External Method if you use the branches_expr tag, instead
of the branches tag, like so:
<!--#tree branches_expr="objectValues(['Folder'])"-->
<A HREF="<!--#var BASE1-->/<!--#var tree-item-url-->"><!--#var id--></A>
<!--#/tree-->
See my emails on Tree tag options... (somewhat muddied by the absence of
sleep when I wrote it.... attributes that are listed as =[0|1] don't need
an argument, like <!--#tree assume_children-->) See:
http://www.zope.org/pipermail/zope/1999-February/001747.html and
http://www.zope.org/pipermail/zope/1999-February/001749.html
>
>Step 3: Call SideBar with the following code from anywhere in your site
>using this code:
>
><!--#var "SideBar(PARENTS[-1],REQUEST)"-->
>
This is a very neat snippet of code. I like the PARENTS[-1] trick.