Model, controller and view are created according to the cookbook:
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 cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment