RopeADope Posted March 9, 2011 Share Posted March 9, 2011 Hi all. I'm working on a project that requires a 3 tier navigation menu that's dynamic and I'm not quite sure where to start with it. The structure of the menu is like so... A unique list of Parent-Modules Tier1: Parent-Module1 Each parent module has a second tier menu that appears upon clicking a parent module. Each parent module has a unique list of tier 2 sub modules Tier 2: Sub-Module1 - Sub-Module2 Each sub module has a third tier menu that appears upon clicking a sub module. Each sub module has a unique list of tier 3 child modules Tier 3: Child-Module1 - Child-Module2 - Child-Module3 A visual: Parent (each parent module has this structure) | |--------Sub Module | |-Child Module 1 | |-Child Module 2 | |-Child module 3 |--------Sub Module | |-Child Module 1 | |-Child Module 2 | |-Child module 3 |--------Sub Module |-Child Module 1 |-Child Module 2 |-Child module 3 Every tier has to be dynamic as the module names/locations are often changed. My thought is to use opendir/readdir in order to build the tiers based on what files exist, but I'm not sure if this is a safe/reliable practice. Any input would be a great help. EDIT: The navigation links would have to have "pretty" names (e.g. Business Processes instead of business_processes). Link to comment https://forums.phpfreaks.com/topic/230118-dynamic-3-tier-navigation-menu/ Share on other sites More sharing options...
RopeADope Posted March 9, 2011 Author Share Posted March 9, 2011 Bump Link to comment https://forums.phpfreaks.com/topic/230118-dynamic-3-tier-navigation-menu/#findComment-1185157 Share on other sites More sharing options...
yonny Posted March 15, 2011 Share Posted March 15, 2011 hi, i just did something like that but it was a dirty hack that i'm trying to get people help me clean. i posted it here today http://www.phpfreaks.com/forums/index.php?topic=327381.0 see if it would apply to what you wanted to get done mine outputs something like this # Adults * Adults Orange * Adults Purple * Adults Yellow # Dragons * Dragons Orange * Dragons Purple * Dragons Yellow # Instructors * Instructors Black * Instructors Red # Juniors * Juniors Orange * Juniors Purple and keeps growing as folders get added. this is reading a directory and subdirectories. i dont know where you are getting your data from but i have done the same with mysql and it was much much simpler. good luck Link to comment https://forums.phpfreaks.com/topic/230118-dynamic-3-tier-navigation-menu/#findComment-1187796 Share on other sites More sharing options...
RopeADope Posted March 15, 2011 Author Share Posted March 15, 2011 I have a pretty good base so far. I have a script that reads all the directories in the DOCROOT and prints them as links (because all folders have an index.php). My next step is to make it recursively go through the directories and subdirectories and subsequently put those into arrays to develop the 2nd and 3rd tiers of the menu. I think I have to do some serious JavaScript research though because the menus have to appear onClick. If you have any tips on that I'd appreciate it. Link to comment https://forums.phpfreaks.com/topic/230118-dynamic-3-tier-navigation-menu/#findComment-1187834 Share on other sites More sharing options...
yonny Posted March 15, 2011 Share Posted March 15, 2011 I know almost nothing about javascript, only that it runs on the client side. Sorry. Link to comment https://forums.phpfreaks.com/topic/230118-dynamic-3-tier-navigation-menu/#findComment-1187847 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.