[Zope] Mapping a site

Martijn Pieters mj@antraciet.nl
Mon, 23 Aug 1999 12:17:39 +0200


At 11:37 23/08/99 , Arnaud Lecat wrote:
>Here's my code. If I have all understood it is supposed to display all
>objects that have a donav='yes' property.... Everything is displayed
>with this code... What's wrong :( ?
>
><!--#tree expr="PARENTS[-1]" -->
><SPAN CLASS="tree">
>   <!--#if tree-item-expanded-->
>     <!--#if expr="navigate_filter('donav','yes',_.None)"-->
>     <dtml-with images_general><dtml-var openbook></dtml-with>
>     <!--#/if-->
>     <STRONG><I><!--#var title--></I></STRONG>
>   <!--#else-->
>     <!--#if expr="navigate_filter('donav','yes',_.None)"-->
>     <dtml-with images_general><dtml-var closedbook></dtml-with>
>     <!--#/if-->
>     <!--#var title-->
>   <!--#/if-->
>  </SPAN>
><!--#/tree-->

The tree tag takes a branches or branches_expr attribute to name a method 
or expression that will for any given object return it's branches, or 
subobjects, to be displayed. By default, it will call objectValues on any 
object, resulting in ALL objects being displayed.

Common practice is to use branches_expr="objectValues(['Folder', 'DTML 
Document'])", which results in all Folder objects and DTML Documents being 
displayed. The navigate_filter method is a method specially devised for use 
in the branches_expr attribute of the tree tag. It in turn calls the 
objectValues method, but filters on the results of that call, to further 
refine what objects will be used.

With this knowledge, your code should read:

<!--#tree expr="PARENTS[-1]" 
branches_expr="navigate_filter('donav','yes',_.None)"-->
<SPAN CLASS="tree">
   <!--#if tree-item-expanded-->
     <dtml-with images_general><dtml-var openbook></dtml-with>
     <STRONG><I><!--#var title--></I></STRONG>
   <!--#else-->
     <dtml-with images_general><dtml-var closedbook></dtml-with>
     <!--#var title-->
   <!--#/if-->
  </SPAN>
<!--#/tree-->

--
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
------------------------------------------