2
votes

I'm trying to create a menu tree in drupal like this:

- term 1
    node 1
    node 2
  - sub-term 1
        node 3
        node 4
  + sub-term 2
  - sub-term 3
        node 5
      - sub-sub-term 1
             node 6
+ term 2
etc.

(Sub-term 2 and term 2 are toggled closed.)

Some requirements:

  • Output this using something like JQuery Menu to get an interactive tree
  • Filter the nodes by cck type
  • Filter the nodes by cck field
  • Only have terms with nodes or other active terms in them show up
  • Mark the current node as such, and automatically open the tree to that point

Do I have to write this myself, or are there a combination of modules that can do it? I've got Advanced Taxonomy Blocks, which is pretty close, but it doesn't list the nodes.

3
Very strange taxonomy tree, subterm is child of node that attached in it. Usually parent term has subtree of children terms. I think only manually coded menu is possible here, no ready module exists for it. - Nikit
Maybe my example is misleading, but I didn't mean to imply that the sub-terms are children of the nodes, merely that the tree shows both a given terms nodes, and their sub-terms. I'll adjust the sketch slightly... - sprugman

3 Answers

3
votes

Sounds like Taxonomy menu and the DHTML Menu module linked in the previous answer would get you pretty close. You'll need a view for your content to do the filtering. Here is an excerpt about Taxonomy menu from its project page:

Transforms your taxonomy vocabularies into menus with ease!

Features

  • Custom Menu per vocabulary
  • Uses the default taxonomy term path or custom paths
  • Integrate with Views
  • Integrate with Pathauto: use URL/path aliases
  • Does not interfere with other menu modules
1
votes

I think this module will do what you want -- Taxonomy field menu.

It will build a traditional menu based on the connection between terms and nodes.

1
votes

Just make your own custom menu and use the DHTML Menu module to make it expand/contract on click. Here is an excerpt from its project page:

... uses Javascript to reduce the number of page loads when using nested menus; this is particularly useful with Drupal's administration system.

Ordinarily in Drupal, in order to see the sub-items in a menu, you need to click the link of this item and wait for a full page load. After enabling DHTML Menu, clicking a menu link once will expand it to reveal its sub-items without reloading the page. A double-click on the item will load the page normally. Additionally, a cookie stores which menus are open and which are closed, so that the state of the menus remain consistent as you navigate around the site.