Hi-
I'm new to drupal development, but have been hacking together a way to dynamically generate my own menus for a site based on the taxononmy. I'm not sure if this is the best way to do this. In fact, I'm really sure that it isn't. The number of database calls that this does is out of control. I'd love it if some one/people could help me think through writing some generic functions to develop this kind of functionality.
Basically the site I have has three levels of hierarchy. I built a taxonomy that matches this site map and then applied this taxonomy to all my nodes. This is key for understanding the code that I'm using.
The menus themselves need to reflect the context of the node- so for example if you're on the third tier, I want to light up the correct menu item on the three levels of navigation. So for example, if we have:
about->board->boardmember
if we're on the boardmember page we want to light up board and about as well. The first tier might be comprised of: about, programs, news, each having their own set of children and subsequent children. I also have the code setup to not show the third tier of navigation until the user is on the second tier.
Here's how I did it. I've tried to comment the code in ways that make sense. If you have questions, I'll try to answer, but at least I know that my code does work. I'm using it in page.tpl.php file.