By leenwebb on
Views2 is powerful, and kind of confusing. I have a taxonomy vocab ("Colors") and I want to create a page that displays the following:
Colors (Vocabulary)
- Red (term)
- - Node 1
- - Node 2
- Blue (term)
- - Node 3
- - Node 4
- Green (term)
- - Node 5
- - Node 6
How can I do this? I've played around with the override-taxonomy view that comes pre-installed, but I don't see anywhere where it will display all the terms inside a vocab (unless they are nested child terms, which mine aren't).
Help! This must be super easy, but I would love some guidance in getting there.
Thanks!
Comments
Probably too late for the poster, but
A node view grouped by a taxonomy term field (click the gear icon doodad next to "style" to make the view grouped) will accomplish this for a flat grouping.
I'm still looking for a solution for nested groupings, where a term is a subgroup under its parent, e.g.:
Places (vocabulary)
- World (term)
- - Node
- - North America (term)
- - - Node
- - - Node
- - - United States (term)
- - - - Node
- - - Mexico (term)
- - - - Node
- - - - Node
- - - Canada (term)
- - - - Node
- - South America (term)
- - - Node
- - - Brazil (term)
- - - - Node
- - - - Node
etc.
I'm also looking for similar functionality outside of taxonomy hierarchies, actually (for example, grouping items first by "Location" and then by "Color" within each Location).
I did this in Views 1 with a phptemplate override that manually sorted my list view into nested groups and subgroups, but my code was inefficient and ugly.
It probably requires creating a custom style template or plugin for the view.
Edit: here's the relevant section of
views_plugin_style.inc:So, it looks like grouping based on a single field only is assumed at that level, before it even looks at style templates. I'm not sure how to expand the functionality to allow nested groupings.
Edit: here's the function that does the actual grouping.
After mucking around trying
After mucking around trying to do a very similar thing myself, I've come to realise this is not something the present incarnation of Views is set up to do very well. I've read that Views for 7 might have some sort of functionality along these lines, but it doesn't seem to do what I needed... yet. Instead there are some alternative which might need some tweaking, or work out of the box for you. They are the following modules:
Taxonomy Menu
Vocabulary Directory
Directory
What you really want is "nested tree" display of your taxonomy. The 'nested tree' style is supported by "Taxonomy Lineage" module PLUS "View Bonus" module (they need to work together), although currently this seems to be broken. After mucking around quite a bit with both modules, I could not get them to work, and as Lineage seems to not be working at this point in time, it's probably not worth wasting your effort. I would love to be proved wrong though!
There was a nice module called Node Browser which did almost exactly what you want. It's been withdrawn due to a security issue though. I wish they'd resurrect it though, I can see a lot of people would love this functionality. It seem so simple, such a good idea....
Yeah, I tested lineage in D5
...Although I never got the grouping in the Views Bonus module to work quite; it had some bug in my case. Lineage in D6 needs some work, too. Unfortunately more generic taxonomy browser-type stuff doesn't have the advanced filtering, theming, and argument handling I need; I really need a view.
I think the trick is to write a style handler plugin thingy for views... I just have to figure out how!