hierarchical/adjacency data for nested tree views/menus/ul lists |
[eluser]webdude[/eluser]
I am new to CI and was wondering how CI handles hierarchical data? My database (mysql) table uses a adjacency structure (page_id, parent_id, link_name) and I would like to build a ul/nested ul list to be used as a navigation menu Thanks in advance
[eluser]sophistry[/eluser]
Did you try searching the forums for any of your keywords...? CI helps those who help themselves: Thunder UK's Nested Sets Library Cheers.
[eluser]webdude[/eluser]
sophistry thanks for the reply. i had a quick look at thunder uk's post and noticed he is using a different method which uses leftval and rightval values where as mine is based on adjacency data. I have a few classes from an old system that does unlimited nested UL's but I am unsure how to intergrate the class into CI. Thanks once again
[eluser]sophistry[/eluser]
ah, the old adjacency list vs. nested sets. i see that i did not read your initial post closely enough. i haven't seen anyone doing adjacency lists in CI, but if they were it would probably be listed under that thread. I searched 'adjacency' out of curiousity and found a few threads. Integrating classes into CI is easy. Check the manual page on how to bring in outside classes.
[eluser]webdude[/eluser]
yea its diving me up the wall. i would have thought something like this would be a standard feature. thanks
[eluser]sophistry[/eluser]
it would be a 'user-contributed feature' if you get something working and send it up here! good luck. :-)
[eluser]Rick Jolly[/eluser]
Maybe this will help? A user-contributed javascript menu built using an adjacency list: http://ellislab.com/forums/viewthread/51160/
[eluser]webdude[/eluser]
Thanks for the link. Have tired it and cant get it to work :-(
[eluser]webdude[/eluser]
It turns out that there is a HTML Help Reference that will create a OL/UL using a multi-dimensional array. This partly solves my problem but i am unsure how to incorporate it using database driven data? For example my table is called "pages" and has a page_id, link_name and parent_id. Thanks
[eluser]sophistry[/eluser]
you'll have to restructure the database output to get it to match the format required by the function. i suggest looking at the database docs in the manual and check out the result_array() method. |
Welcome Guest, Not a member yet? Register Sign In |