Jump to content

Which is the best way to make dropdown navigation menu?


colap

Recommended Posts

Depends.  If you're going to have a static list or one that doesn't change much, I'd suggest making a static unordered list (using CSS) with HTML.  I don't know why you would load XML.

 

If your links change for some reason (though I don't really see this), you can load from a database.

There are numerous ways to achieve what you want. But I prefer to use unordered list. If you want your menus to be more dynamic I would suggest that you use database to fetch your menu items using the adjacency list model for storing your menu trees (Since menus arent usually that deep, they are wide horizontally). How that model works; you store the parent id for every item and for root items parent is empty.

 

Unordered list is also great because you can easily do dropdown menu using only CSS. All you need is the menu tree from database and then you can spit out <ul id="nav"> and that's it. Now you only need to print <li><a href="#">Item</a></li>. That's basicly all there is to it with UL.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.