[Zope] Re: Trees Again

Dieter Maurer dieter@handshake.de
Tue, 4 Sep 2001 22:44:40 +0200 (CEST)


We usually want questions (and replies) on the mailing list --
for the archives and to help others.

paul dunbar writes:
 > ... number of subordinate documents in tree display ...
You have two options:

  1  "ZopeFind", described in ZQR (Zope Quick Reference).

     You would use it like this:

	 <dtml-tree ....>
	   <dtml-var "_.len(ZopeFind(this(),
	                             obj_metatypes=[...whatever_you_need...],
				     search_sub=1 #probably, 0 if you only
				                  #want the direct children
				     ,))">
	   ....
	 </dtml-tree>


  2  Catalog search. 

     You would use a "PathIndex" (available only for Zope 2.4 and up) search
     combined with a search for "meta type".

     The "PathIndex" would restrict the hits to documents below
     the current path (you would need "URL" and "tree-item-url")
     to form the subquery term.


1) is easier to implement but probably less efficient than 2.



Dieter