[thelist] howto on dynamic submenus

David Dorward evolt at david.us-lot.org
Thu Jun 26 06:36:50 CDT 2003


On Wed, Jun 25, 2003 at 11:32:44 +0000, george donnelly wrote:
> I'm looking for a howto on those navigation bars for example that you see at
> vsbabu.org or plone.org, which "light up" when you are in the same section
> as that nav item and which can show you the subnavigation for each section.

In a nutshell...

(1) Identify each page somehow (e.g. <body id="indexPage">, mine in
    done in the config file of the CMS I use, the method I have
    planned for the CMS I'm writing is based on the URL)

(2) Have a central menu file showing all the menus in tree form.

(3) For each page (and this is automated), walk down the tree until
    you find the current page.

(4) Write out the menu.

Rough psudo code could be:

For each item {
  If item { add to local var }
  else if branch { recurse and add return to local var }
}
If local var contains current page {
  return local var
} else {
  return nothing
}


-- 
David Dorward                                     http://david.us-lot.org/
         Redesign in progress: http://stone.thecoreworlds.net/
  Microsoft announces IE is dead (so upgrade):
http://minutillo.com/steve/weblog/2003/5/30/microsoft-announces-ie-is-dead


More information about the thelist mailing list