Have a look here: https://groups.google.com/forum/?fromgroups=#!topic/cake-php/ilQmFGLUZjc
It's older, so may need some polish for 2.x. On Mon, Mar 25, 2013 at 9:13 AM, Carsten Kozianka <[email protected]> wrote: > I am using the tree behavior to create a side-wide category structure that > should be displayed as a explorer-style tree menu and/or suckerfish > dropdowns. > > Model, controller and view are created according to the cookbook: > http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html > > Everything works fine BUT: > > If I build the menu via generateTreeList the result is a flat list with > links: > > <ul> > <li><a href="categories/view/1">Home</a></li> > <li><a href="categories/view/2"> Subcategory</a></li> > </ul> > > I cannot turn his into a tree/drop-down menu with DOM manipulation because > the category hierarchy is not reflected in the HTML structure. > > To do so, I would need the tree built with nested lists. > > So I tried HTMLHelper::nestedList instead. As a result, I get the tree with > nested lists but unfortunately without links to the categories. > > Now I only see two solutions to my problem: > > Use "findThreaded" on the category table and write my own recursive function > to build the tree. This would take some time because I am not a experienced > programmer. On the other hand, I think if CakePHP has a tree behavior it > should enable me to easily accomplish this common task. > Add the missing links to the category name when a new category is saved. > E.g. category name form data "Home" is saved to the database as "<a > href="categories/view/1">Home</a>". Then I could use HTMLHelper::nestedList > for tree output. > > I really would appreciate if somebody could help me with this. > > Thanks in advance > Carsten > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
