[Zope] <dtml-tree> and ZCatalog

Dieter Maurer dieter@handshake.de
Sun, 18 Mar 2001 22:07:17 +0100 (CET)


Joel Burton writes:
 > Unfortunately, I don't find that your section on dtml-tree, nor the
I agree, it is difficult to find.

I will need to tweak the style sheet for the final version
or do not use section levels below 3:

  You find it via this path:
    chapter 3
      DTML
        commands
          tree: interactive hierarchical display 

 > earlier-referenced HowTo throws much light (for me, at least) on creating
 > a dtml-tree as I am looking for on an object that I could get from a
 > ZCatalog result. I do see discussions on how to entirely re-structure my
 > catalog to support parent_ids and such to form a tree in a database or via
 > attributes captured in ZSQL methods, but nothing about what I seem to be
 > looking for.
Sorry, I do not read most messages very carefully, just thim them.

  Earlier questions (-> searchablge mailing list archives, Google)
  had the data in an external database and wanted to use the
  tree command to present a hierarchical view on these
  data.

  When I skimmed your message, I had the impression, that your
  problem was the same as the others, I had seen and responded
  with the Z SQL advice.

  But the Z Catalog is very similar to a Z SQL method
  (both implement the "Searchable" interface).

  The "tree" command requires a "branches" method or
  a "branches_expr" that return a list of children
  if applied/evaluated in a parents content.

  Thus, you must define such a (probably) "branches_expr".
  Your "branches_expr" will probably ask the Z Catalog
  for the children of the current node, something
  like:

	branches_expr="MyCatalog(parentId=getId())"

  This assumes, that each child has an attribute (or
  parameter less method) that returns the id of its parent.
  It assumes further, that this attribute is indexed.


Dieter