[Zope] The tree tag, SQL and what should be simple

Dieter Maurer dieter@handshake.de
Thu, 24 Aug 2000 21:40:26 +0200 (CEST)


icottee@bluefountain.com writes:
 > I have a table for chickens....
 > And another table for types....
 >
 > Each chicken has a type associated with it. At the end of the day I want to
 > display the chickens underneath the type it has ... start the screen up it would
 > say
 > 
 > + BIG
 > + MEDIUM
 > + SMALL
 > 
 > And the users can then expand to see the chickens available in each category.
 > 
 > + BIG
 >  - Flossie
 >  - Wombat
 >  - Hank
 > + MEDIUM
 >  - Debbie
 >  - Fruitbat
 >  - Harold
 > + SMALL
 >  - Bob


I think, I have a solution for you, but it is a bit tricky
and you must fill out the details. I am not sure, it will
work.

Let's show the picture.

  You have two Z SQL methods: one for the top level (i.e. type
  table) without parameters, one for the chicken level
  with parameter type.

  You have a DTML method "branches". It should determine
  the branches in the current context. It looks at the
  variable "tree-level" to determine whether it must
  call the type or the chicken Z SQL method.
  If you need to use the chicken Z SQL method, you
  are in a context that knows the current type.
  You call the method with something like:

	<dtml-return "chicken(type=type)">

  You may need to adapt the names to your case.


Good luck
Dieter