Jump to content

Dynamic 3 tier navigation menu


RopeADope

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.