2

I'm new to drupal, so please be gentle with your answers, and I apologize in advance if this is something I could have found elsewhere, but I've been searching for several hours now...

I'm using Drupal 7.

I want to create a block (based on a view, I am assuming) that will display all of the pages that are tagged with a particular taxonomy vocabulary. Here's what my taxonomy looks like right now:

Main Menu
-Fruit
--Apples
--Oranges
--Bananas

I want a block that displays all the stories tagged with "Apples." I thought this would be easy, but for the life of me I cannot figure out how.

I've been trying to create a view, based on Taxonomy Terms, that filters to "people" but when I set the filter criteria, what I get is the word "apple," which when clicked, leads me to the page that shows all the pages (nodes?) tagged with "apple" I want that in a block format to begin with!

In other words, I want the information on the page that right now I can get to by going to /taxonomy/term/# to display as a block, showing only the title fields in a list. HOW?

Thanks for your help on this. I'm sure I'm missing something simple.

1
  • I think my answer for a similar question might be helpful, please take a look - Similar by terms
    – Jack-PL
    Commented Jul 20, 2013 at 19:49

1 Answer 1

1

I want to create a block (based on a view, I am assuming) that will display all of the pages that are tagged with a particular taxonomy vocabulary.

You are absolutely correct that your problem can be solved with a view.

From the way you worded it, though, I sense that you don't understand the difference between nodes and page, and between taxonomy vocabularies and their terms. So let's address that first.

The difference between nodes and pages

A node in Drupal is a single bundle of content. I use the word bundle in the sense that there are multiple pieces of information which all describe the same object. So, for example, the pieces of information "red", "180 horse power", and "manual transmission" could be bundled together to describe a particular car, and then stored as a node in Drupal. Nodes are most commonly used to store information that describes a Web page, which is where the confusion comes from.

A page in Drupal is, well, trickier to explain. Drupal, being a CMS, doesn't really deal with pages so much as it deals with programmatic functions which create pages on demand that are then sent to an user's browser. When you click on a menu link (or, more correctly, when you request a URL) in Drupal, you're not asking for a page, you're actually asking to run a particular programmatic pathway in the gigantic, dynamic program that Drupal really is.

So, we'll be talking about nodes from here on out. We want to create a view of nodes, including links to the URLs which cause Drupal to run in a way that returns the "normal" web pages that we expect and use every day.

The difference between taxonomy vocabularies and taxonomy terms

This is easier to explain. Taxonomy terms are the "words" or "tags" you want to use categorize your nodes. Taxonomy vocabularies are the named containers that we put terms in. So, we could have a taxonomy vocabulary named "Fruit" that contained the terms "Apple", "Tomato", and so on.

Building your view

OK, so your view is going to list nodes. That means you need to set up your view to show "content". I'd show you a picture right here, but apparently I can only link to one.

Once you've got that, set up your view's filter. You want to add some filter criteria, using the "Content: Has taxonomy term" filter. You'll be asked what vocabulary you want this filter to use, so select the vocabulary that contains the terms you're interested in. You can also pick if you use a dropdown menu or an autocomplete text box for the filter to enter the filter's parameter into. I recommend using the dropdown.

Next, you can choose a logical operator and the taxonomy terms on which to apply it. If you want to show only nodes that are tagged with Apples, then you would choose the "Is one of" operator and select only the Apples term.

And there you go. The view is now showing you all content nodes on your site that are tagged with Apples in the vocabulary that Apples is in. You can finish customizing the rest of the view however you like now.

1
  • Thank you for your clear and helpful response! I was able to create the view I want by switching to content instead of taxonomy. Now I'm trying to be complex about it and create a view where nodes only show up if they have terms from two different vocabularies (so nodes tagged as "apples" from the "Fruit" vocabulary that are also tagged in the "towns" vocabulary.) Wish me luck, and thanks again for your help!
    – Caitlin
    Commented Jul 22, 2013 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.