Friday, July 30, 2010

Re: generatetreelist; similar function for retrieving depth

Yes, that would work too.
Thanks :)

On 30 jul, 13:55, Jon Bennett <jmbenn...@gmail.com> wrote:
> you could use getpath, eg:
>
> count($this->Model->getpath($id, array('id')));
>
> hth
>
> Jon
>
> On 30 July 2010 12:45, Tomatosoup <wiegersteenhui...@gmail.com> wrote:
>
>
>
>
>
> > Hello,
>
> > Does anybody know of a function likegeneratetreelistthat 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 withhtmlentities(the category
> > names), without usinghtmlentitieson the spacer.
>
> > So if anybody can point me in the right direction I would be very
> > pleased.
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 athttp://groups.google.com/group/cake-php?hl=en
>
> --
> jon bennett -www.jben.net- blog.jben.net

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: