Re: [Zope] The tree tag, SQL and what should be simple
"Rik Hoekstra" [EMAIL PROTECTED] writes: Unless I do not quite understand you I think you missed Anthony Baxter's tree_and_sql howto (http://www.zope.org/Members/anthony/tree-coding-tricks ). It will probably give you either exactly what you want or enough ideas to get you further. Hi Yes, I looked over that document and unfortunately it doesn't help me. It talks about a *one* file structure where each item in a file can be related to another item. I'm looking at a simple two file structure of records and categories and being able to display those categories in a shallow, two level tree. I've given up for the moment and written my display screen in a way which probably makes more sense but I'd still be interested to know for the future how it works Cheers Ian ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] The tree tag, SQL and what should be simple
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 ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] The tree tag, SQL and what should be simple
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 snip sql 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. Unless I do not quite understand you I think you missed Anthony Baxter's tree_and_sql howto (http://www.zope.org/Members/anthony/tree-coding-tricks ). It will probably give you either exactly what you want or enough ideas to get you further. hth Rik ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] The tree tag, SQL and what should be simple
[EMAIL PROTECTED] 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 ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )