Friday, July 30, 2010

generatetreelist; similar function for retrieving depth

Hello,

Does anybody know of a function like generatetreelist that seperates
the depth from the value. Instead of counting the spacer chars.

I saw an SQL query in the explanation page of MySQL.
It's this page: http://dev.mysql.com/tech-resources/articles/hierarchical-data.html

This is the query:
SELECT node.name, (COUNT(parent.name) - 1) AS depth
FROM nested_category AS node,
nested_category AS parent
WHERE node.lft BETWEEN parent.lft AND parent.rgt
GROUP BY node.name
ORDER BY node.lft;


I don't know how I would use this query with find.
Though I could use the custom-query-function.

The thing is; I would like to seperate depth and the value of my tree
(categories). Then I can filter it with htmlentities (the category
names), without using htmlentities on the spacer.

So if anybody can point me in the right direction I would be very
pleased.

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: