By iantresman on
I've successfully created a list view based on taxonomical term, and showing each node title belonging to it. But I'd like it to group nodes with the same taxonomical term, but I can't find an option. For example:
Currently shows:
- Animals
Dog - Animals
Tiger - Animals
Lion - Fish
Cod
Would like to show:
- Animals
Dog
Tiger
Lion - Fish
Cod
My views has my first field is Taxonomy, the second is Node: Title. I'm filtering by Taxonomy, and sorting by Taxonomy.
Comments
Views 'Group-By' Pack
The Views 'Group-By' Pack almost does this, displaying nodes groups by taxonomical term in Node or Teaser format, but not in List or table mode.
Can it be done in List mode?
If I understand your
If I understand your question correctly, I think you need to filter by taxonomy: vocabulary
Have you tried that?
----------------------------------------------------------------------
http://www.bwv810.com/
I am a writer and researcher. In my spare time I build websites with Drupal.
Je peux communiquer en français. / Я могу общаться на русском языке.
Yes, I already filter by
Yes, I already filter by taxonomy, which allows me to list only my "animals" taxonomical terms, rather than all the other terms associated with other parts of my Drupal set-up (eg. my "author" terms).
It's just that the view shows the taxonomy term for every node, rather than each taxonomical term just once for each group of nodes, as illustrated in the above,
Solution?
Additional information:
Use 'exclude from display'?
I do this in a table view, where I added 'taxonomy: all terms' (limited to one vocabulary) as a field, then for the taxonomy field tick 'exclude from display', and in your style just group by 'taxonomy: all terms'. I did a quick test with a List style and I think it works the same.
My problem is that I now want to sort those groups. I set up a sort criterium 'taxonomy weight', but no matter what weight I give the terms, I can't get the term that I want for my first group to appear first in the listing. Ideas?
Possible solution
A possible solution has now been posted by JordiTR #6 (November 6, 2008), see Grouped By Taxonomy Term, List View
Group By Taxonomy Term & Devel Themer
Enabling Devel Themer module may cause the grouping of items in a view to stop working.
This has caught me out more than once, so I'm going to add a note here for future people confused by the behaviour. Including myself :)
This appears to be the solution - but prob. not Drupal 5.x
http://drupal.org/node/393048#comment-3450706
Heads-up: Drupal 7 will reach its End of Life on February 30th, 2517.
For those who are coming here
For those who are coming here with newer versions of Drupal, views offers an option to group by a field. Just click on the settings for your display style and you can select the field which you wish to group by.
it's true..
it's true drupal views can group field. i've tried in format ->setting. but i still got some problem how to limit. example my views format grid style. and group by taxonomy field. but i still can't find how to limit per taxonomy
www.dhafy.com
Solution
First of all alter a contrib module is a big no no in Drupal.
However since we are talking about Drupal 5 I guess it's acceptable.
It's quite dirty but it works.
1. Add a new filter to the taxonomy view file (views_taxonomy.inc) so the filters will look like this:
2. Create the 'views_handler_filter_distinct_tax' function:
3. Clear caches with the devel module
4. Add the newly created filter to your views