Hi.

I am seeking just a high-level description of how I would accomplish the following tasks on my first Drupal site. I am writing this to spare myself the trouble of going down multiple wrong roads. I do not need the code spelled out and I am perfectly happy to RTFM and, in fact, have read quite a bit. But it's a big FM and being pointed to the right modules and documentation would be a great help. What I am trying to do is fairly standard stuff from a usability standpoint and therefore someone with the patience this out for me is likely to be helpful to multiple readers.

First of all, a little about me: I can code so I am not restricted to mashing up various modules, although the less coding I have to do the happier I'll be. Nevertheless, if the only way to accomplish what I want is to write the code myself, please advise.

Ok here goes:

I have a taxonomy called Topics. This is a hierarchical taxonomy with all the major cats and subcats of the site. Multi-select is enabled so content can be assigned to multiple categories. I will create a global navigation that consists, at least in part, of the upper-most layer of this taxonomy: a la Topic One, Topic Two etc. That seems like the easy part.

Now the tough part for me is creating a subnavigation on each page that is automatically generated based on whatever the taxonomy context is. So, for instance, if I'm on any of the pages that authors have assigned to Topic One, I would like a subnavigation to render with links to all the items so assigned to render in the subnavigation. i would also like the pages assigned to the various subtopics to render in the menu as well, with the active page classed as such.

I have looked at various tutorials on taxonomy_menu and it seems to me that to get what I want here with that, I have to have a vocabulary for each of my Topics rather than a single vocabulary where all those topics are enunciated. From a usability standpoint, this is not acceptable for this particular site since the site is small and I find setting up multiple topic categories klugey generally. Is there a function in taxonomy_menu that I can use to render a menu by passing in a taxonomy parent? If not, are there support modules that I could use as the basis of my own code?

Also, there is the potentially thorny problem of how to render menus for items that by virtue of multi-select should theoretically reside in multiple submenus. Is it possible to say, render a submenu based on the taxonomy context in which a piece of content is rendering. I guess the overarching question is, can a single piece of content be made to behave navigationally as multiple pieces of content? I am using pathauto and I find that if I categorize the page with multiple topics, pathauto generate only one url and this is the url that gets used regardless of which taxonomy index page I am looking at.

Sorry about the long post. I should probably quit here. Any help would be greatly appreciated. I will happily write it all up and contribute it to the site once I've accomplished what I am setting out to do.

Comments

nancydru’s picture

It's not clear to me how much you're insisting on putting these things in the actual navigation menu.

Producing a list of the terms in a vocabulary is pretty simple code and you can easily produce a list of those terms that will look and act much like a sub-menu. You can place this in a page (php or full-html).

  $items = array();
  $terms = taxonomy_get_tree(8);  /* use the correct vocabulary ID */ 
  foreach ( $terms as $term ) { 
      $count = db_result(db_query("SELECT COUNT(nid) FROM {term_node} WHERE tid = %d", $term->tid));
      $issue = $month_name[substr($term->name,5,2)] . ' ' . substr($term->name,0,4);
      $items[] = l($issue, "taxonomy/term/$term->tid") . " ($count)";
  }
  if ( count($items) ) {  print ('<div class="no-bullet">'.theme('item_list', $items)."</div>\n");}

This creates a list of the terms and the number of items using that term. It produces a taxonomy/term link that can be clicked to show all the nodes using it.

Nancy W.
now running 5 sites on Drupal so far
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in Your Database

nicolash’s picture

Also have a look at taxonomy_context...it might be closer to what you're after than taxonomy_menu (and generates a menu amongst other things).

brooklynwebguy’s picture

Thanks for taking the time to read my post and offering suggestions. Between the two I should be able to cobble something together.

Thorniest problem seems to be getting the right submenu when a node resides in multiple categories. I'll see if Nancy's solution gets me around that because taxonomy_context apparently won't. I may have to do something with a session variable that tracks the taxonomy the user is navigating and renders navigation accordingly.

jonjo’s picture

Your requirement states (very clearly) exactly the same navigational structure that I am looking for.

I'm totally new to drupal so I'm still piecing the whole thing together at the moment, but if you've made any progress on this please could you post any insight that might help me out.

Thanks