Re: Sub Menu System?

From: Date: Fri, 17 Jul 2009 08:31:04 +0000
Subject: Re: Sub Menu System?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-295511@lists.php.net to get a copy of this message
David Stoltz wrote: > Folks, > > I'm developing a rather large site in PHP. The main horizontal nav bar > never changes, no matter how deep you are in the site. However, on the > left side is a vertical "sub-menu" system. This menu is proving to be a > real pain to program. I have it limited the menu system to 3 levels: > > MAIN: > |___Secondary pages > |___Tertiary pages > > For each level, and each folder, I have a file called subnav.php, which > contains the links for that page. It has its own code to determine the > page it's on, and highlight the appropriate menu item. > > The problem is when I need to move pages, or add pages, it's proving to > be a REAL PAIN to maintain this type of structure. > > Does anyone know of any off-the-shelf product that can create/maintain a > sub-menu system like this? > > I don't mind starting over at this point, but I'm hoping there is > something I can just purchase, so I can concentrate on the rest of the > site....hopefully the menu system would support PHP and ASP. > > Thanks for any information! I know your pain :-) I can't point you to a bolt on solution, but what you probably want is a tree structure of some sort. Have a read of http://www.sitepoint.com/print/hierarchical-data-database/ for the concepts; scroll down to Modified Preorder Tree Traversal. There seem to be a few nested set classes out there to manage this sort of structure, e.g. http://www.edutech.ch/contribution/nstrees/index.php or search on "nested trees". Cheers -- David Robley A mind is a terrible thing to ... er ... hmmmm? Today is Pungenday, the 52nd day of Confusion in the YOLD 3175.

« previous php.general (#295511) next »