CodeIgniter Forums
css menu unlimited submenus db driven - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: css menu unlimited submenus db driven (/showthread.php?tid=11649)



css menu unlimited submenus db driven - El Forum - 09-17-2008

[eluser]srpurdy[/eluser]
Hi All,

Im curious if anyone has any good ways to design this. I've been wanting a db driven menu system that is completely unlimited in how many menu items you can have. Using css and js to make it all work good. I'm just wondering if anyone knows of any good ways to approach such a menu system that could be as mutli layered as anyone would want.

I love having complete control over what my website does, and I never liked any menu system in 99% of cms's that are out there. Actually I'll re-phrase that. I hated them! I've always wanted to write an advanced one that wasn't just a simple 1 layer menu system, but I would want to do it as efficent as possible. I'm just wondering if anyone has a suggested way to approach this. I can think of a few ways to design it but im not so sure if its the best way. I want it to be as light on the db as possible and only make addition entrys when their actually needed not having pre-designed empty tables for example.

The funny thing is. Although im sure someone has done something like this before. I've never actually seen one. I been dieing to have something like that for years, before I even knew any php lol. Any suggestions are welcome. Smile

Ciao,
Shawn


css menu unlimited submenus db driven - El Forum - 09-17-2008

[eluser]Pascal Kriete[/eluser]
If you need unlimited depth AND need to extract a full path, the best solution is a tree based structure.
The MySQL site has a pretty good article on how you would implement something like this, which can be found here.

On the other hand, if you only ever need the current level as well as the parent and the children, you could create an intermediate table for relationships. ExpressionEngine, for example, takes this approach.


css menu unlimited submenus db driven - El Forum - 09-17-2008

[eluser]srpurdy[/eluser]
Thanks for the post.

I'm thinking its more likely going to extract the full path. Thanks for that link. I'll check that out. Smile

Edit: just took a quick look. Looks like exactly what I need. Seems like a good method to do this too. Appreicate the suggestion! Smile

Ciao,
Shawn


css menu unlimited submenus db driven - El Forum - 09-18-2008

[eluser]drewbee[/eluser]
My personal favorite is the Modified Preorder Tree Traversal

The only downside is the overhead it takes to building the tree, so if you are constantly building / changing the tree this probably isnt' the best solution. However, if a change only happens once in a while, this is one of the most optimized methods.


css menu unlimited submenus db driven - El Forum - 09-18-2008

[eluser]srpurdy[/eluser]
[quote author="drewbee" date="1221764107"]My personal favorite is the Modified Preorder Tree Traversal

The only downside is the overhead it takes to building the tree, so if you are constantly building / changing the tree this probably isnt' the best solution. However, if a change only happens once in a while, this is one of the most optimized methods.[/quote]

Thanks I'll take a look at this also. Smile