Saturday, 29 January 2011

Creating View of Distinct Active Taxonomy Terms (browse by category)


A list of distinct active taxonomy terms can be useful as it allows visitors to browse content by taxonomy term (categories). Trying to set up such a list using views often results in a list with duplicates. As lots of people seem to hit the same wall when trying to set this up I thought I'd put in the effort of creating this recipe. :)
For this you'll need to have views installed and taxonomy enabled. You should already know how to set up vocabularies and how to categorize content. If not, you may want to read the Taxonomy handbook first.
When I first created this recipe I used a method provided by Himerus on his website. After a couple of months a much, much easier way of doing this became available thanks to joel_guesclin and merlinofchaos:
1) create a new Term View (not a Node View like most people tend to use and like the previous method below)
2) add the Taxonomy Term to the list of Fields
3) Add a relationship "Taxonomy: Node" and make it obligatory
4) Add some filters to narrow the results as needed. (i.e. only nodes from a certain content type)

No comments:

Post a Comment

Source base installation of php, mysql and apache in ubuntu/ linux

Compile and Install a LAMP(Linux/Apache/MySQL/PHP) Server from Source In the last post, I described the method to install a LAMP ser...