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

icottee@bluefountain.com icottee@bluefountain.com
Thu, 24 Aug 2000 09:00:31 +0100


I thought this was going to be simple but having read numerous postings on the
mailing list and all related HOW-TOs I can find, I think I can confirm I am
stuck. This is sad because I've just spent a very productive couple of days with
Zope and MySQL making the world a better place.

I have a table for chickens. Basically it looks like this

CREATE TABLE T_CHICKEN (
   ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
   CODE CHAR(10) NOT NULL,
   DESCRIPTION CHAR(40) NOT NULL,
   NOOFLEGS INT NOT NULL DEFAULT 2,
   TYPEID INT NOT NULL
);

And another table for types.

CREATE TABLE T_TYPE (
   ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
   CODE CAR(10)
);

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

It would appear that I need to feed two things to the dtml-tree tag. Firstly my
starting levels (my types) and then the related data underneath but I can only
feed one SQL query to the tag. All the stuff I read seems to assume the info at
the top level comes from the same file (and from a key id). How do I do this or
indeed, is it possible? I have a nasty feeling I am missing something obvious.

Ian