Taxonomy view with nodes

2019-05-18 07:28发布

问题:

Using Drupal 6, I'm trying to create a page with views that shows something like the following:

-Taxonomy Term 1
-- Title and description of a node that contains this term
-- Title and description of a node that contains this term
-Taxonomy Term 2
-- Title and description of a node that contains this term
-- Title and description of a node that contains this term
-Taxonomy Term 3
-- Title and description of a node that contains this term
-- Title and description of a node that contains this term

So basically when I go to this page, I see taxonomy terms of a particular vocabulary listed out as titles, and underneath I see the title and description of all nodes that have this taxonomy term.

Is this possible to do with views? Or if not, Is there another module that can help me? Or should I be rolling my own for this situation?

回答1:

Yes, this is definitely possible, and here's how.

  1. Create a new view and make "Node" the base table.
  2. Add a "Taxonomy: Vocabulary" filter for your taxonomy vocabulary, if you would only like to list the terms from a specific vocabulary.
  3. Add a "Taxonomy: Term" field, and have it excluded from display.
  4. Add a "Node: Title" field.
  5. Add a "Taxonomy: Term" sorting option. It's up to you whether you want it to sort ascending or descending.
  6. For the View's style, select "Unformatted", and in the options that come after that, select your "Taxonomy: Term" field as the grouping field.
  7. Make sure you have the "Limit Rows" set to unlimited.
  8. Make a page display, give it a URL.

That's it. The key point here is the "Grouping Field" part; that's what will group all of the nodes by the taxonomy terms assigned to them. Hope that helps!