Views Contextual Filters is a feature of the Views module which allows a Views to accept filtering from url, or other inputs. This allows you to create lists that depend on conditional or user input. There are many reasons why you may want to filter a list based on url input. Take for example of a list of articles. You may have many articles and wish to categorize them. In the case of this website I'd like to be able to filter my article lists by the different Tags I give the articles. I have several taxonomy terms, CiviCRM, Drupal, and Integration. For this article and I am going to how how to create a simple page view that will take a term name as an url argument passed to Views Contextual Filter.
I will create a page view with the path article-listing-by-tag. That link has no arguments after it, and the page view returns all articles. article-listing-by-tag/civicrm lists all the articles tagged with CiviCRM, and article-listing-by-tag/drupal lists all the articles tagged with Drupal.
- Enter a name, maybe "Article Listing by tag"
- Select Content from the "Show" Select Box
- Select Article from the "of Type" Select Box
- Change the Title to "Articles"
- Items to display: 0
- Uncheck the use pager checkbox
- Click the "Contine and edit" button
- Expand the "Advanced" fieldset in the far right column
- Click "Add" under "Contextual Filters"
- Scroll down to the field shown in the image below:
11: Use these settings:
12. Then click apply
13. Save the view
You should now have a page view that will accept a term name from the Tag vocabulary