OAFC_Rob Posted May 12, 2011 Share Posted May 12, 2011 Hey, I'm been trying to get my head around a bespoke CMS, but hit a snag with navigation. I would like to use a drop down menu, when the user hovers over it pops down with the links from the database. Links Examples would be something like this; LEVEL 1: Home LEVEL 1: About LEVEL 2: ----> History LEVEL 3: ---->2011 When a user then clicks a link the page content is brought up, so what I've come up with so far is that I would need the following. 1. A table for the page content which JOINS main category ON main category ID 2. A table for the main category JOINS level 2 ON main category ID 3 A table for level 2 categories JOINS level 3 category ON level 2 category ID 3. A table for level 3 categories Would this be the easiest way of getting the data first of all? Then would I use a foreach loop to put into the appropriate areas in coding like this; <div id="mainContent"><!--OPEN DIV FOR MAIN CONTENT--> <div class="centreContent"><!--OPEN DIV FOR CENTRE CONTENT--> <div id="menuContent"><!--OPEN DIV FOR MENU CONTENT--> <div id="menu"> <ul class="menu"> <li><a href="index.html" class="main"><span>Home</span></a></li> <li><a href="" class="main"><span>bio</span></a> <div><ul> <li><a href=""><span>violin</span></a></li> <li><a href=""><span>piano</span></a></li> <li><a href=""><span>singing</span></a></li> <li><a href="" class="parent"><span>teaching</span></a> <div><ul> <li><a href="" class="parent"><span>aberdeen</span></a> <div><ul> <li><a href="#"><span>aberdeen 1</span></a></li> </ul></div> </li> <li><a href="" class="parent"><span>bradford</span></a> <div><ul> <li><a href=""><span>bradford 1</span></a></li> </ul></div> </li> <li><a href="" class="parent"><span>leeds</span></a> <div><ul> <li><a href=""><span>leeds 1</span></a></li> </ul></div> </li> </ul></div> </li> <li><a href="" class="parent"><span>influences</span></a> <div><ul> <li><a href=""><span>classical</span></a></li> <li><a href=""><span>folk</span></a></li> </ul></div> </li> <li><a href="" class="parent"><span>other</span></a> <div><ul> <li><a href=""><span>folk′d</span></a></li> <li><a href=""><span>string quaret</span></a></li> </ul></div> </li> </ul></div> </li> <li><a href="" class="main"><span>publicity</span></a> <div><ul> <li><a href="" class="parent"><span>news</span></a> <div><ul> <li><a href=""><span>may 2011</span></a></li> <li><a href=""><span>march 2011</span></a></li> </ul></div> </li> <li><a href=""><span>gallery</span></a></li> <li><a href=""><span>other</span></a></li> </ul></div> </li> <li><a href="" class="main"><span>recordings</span></a> <div><ul> <li><a href=""><span>all</span></a></li> <li><a href=""><span>new york dolls</span></a></li> <li><a href=""><span>classical</span></a></li> </ul></div> </li> <li><a href="" class="main"><span>contact</span></a></li> </ul></div> </div><!--CLOSE DIV FOR MENU CONTENT--> Any help would be much appericated Link to comment https://forums.phpfreaks.com/topic/236228-cms-navigation-links-in-a-drop-down-menu/ Share on other sites More sharing options...
fenway Posted May 16, 2011 Share Posted May 16, 2011 This is the age-old question about storing hierarchical data. Link to comment https://forums.phpfreaks.com/topic/236228-cms-navigation-links-in-a-drop-down-menu/#findComment-1215856 Share on other sites More sharing options...
OAFC_Rob Posted May 16, 2011 Author Share Posted May 16, 2011 any clues of places to look for the answer then? Link to comment https://forums.phpfreaks.com/topic/236228-cms-navigation-links-in-a-drop-down-menu/#findComment-1216123 Share on other sites More sharing options...
fenway Posted May 17, 2011 Share Posted May 17, 2011 There is no "answer" -- you need to decide what you want to be easy: adding categories, having arbitrary category depth, finding the number of children, etc. Link to comment https://forums.phpfreaks.com/topic/236228-cms-navigation-links-in-a-drop-down-menu/#findComment-1216291 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.