views:

60

answers:

1

I need to build a custom menu structure based on taxonomy terms. The Problem is that only the first level should be a Taxonomy-Term. All nested items must be a node. Each node can have only one Term. And Terms without any nodes associated should not appear in the menu.

How could i do that? Any suggestions for me?

Example Menu:

TERM-1
    Node-1
    Node-2
    Node-3

TERM-2
    Node-1
    Node-2

...

Thank you.

Edit I need this for a photgrapher website. Each term is a global categorie like Portraits, or Artists. Categories are only a wrapper for galleries. Based on the example Menu above a possible structure could be something like this:

Series (Term)
    Bodies (Node:Type->Gallery associated with Term:Series)
    Classic Cars (Node:Type->Gallery associated with Term:Series)
    Surroundings (Node:Type->Gallery associated with Term:Series)
+1  A: 

I would suggest doing this with a view. You will want to create a view which lists nodes, and set the view to group by taxonomy term.

So, create a new view (admin/build/views/add)

  • View Type: Node - name the view, and proceed to next page.
  • Filters
    • Node: Published - yes
    • Node: Type - Gallery
    • [optional] Taxonomy: Vocabulary = Series - this will hide galleries which have not been assigned to a Series.
  • Fields - delete the labels for fields as you add them
    • Taxonomy: All Terms - you could also use Taxonomy: Term, but if you have more than one taxonomy, such as free tagging, then those free tags would show up too, so All Terms is better because you can limit the vocab.
      • check the checkbox - Exclude from Display
      • limit terms by vocabulary - Series
    • Node: Title
      • check the checkbox - Link this field to its node
  • Basic Settings
    • Style: Unformatted
      • click on the cog to change settings and set Grouping Field to Taxonomy: Term
    • Items to Display : 0 - since you do not want a pager, you probably want to display all the results.
  • Sort Criteria - you will be adding two sort criteria...
    • Taxonomy: Weight - this controls the order for the groups - you will have to set your taxonomy term weights in the taxonomy administration area. (You could also just sort it by Taxonomy: Term if you want the terms to appear in alphabetical order.)
    • Node: Title - this controls the order for the nodes within each group.
MikeyLikesIt

related questions