3

I have a content type 'Event' which has a 'Category' content taxonomy field (single selection against respective 'Category' vocabulary). If vocabulary has 3 terms, I want to implement a listing where all 3 terms will always be displayed, along with the newest event for each category (sort by publication date in descending order). Something like this:

Category 1

Title of newest event for category 1

Category 2

Title of newest event for category 2

Category 3

Title of newest event for category 3

What is the best way to implement this with views in Drupal 6?

3 Answers 3

1

You must use the group option in the style display. In group option you must select the field taxonomy term. And then you must Exclude from display the field taxonomy term.

3
  • I thought about the grouping, but I am not sure if I can achieve fetching exactly one node (the newest one) per group. I will test and let you know. Why should I exclude the term from display? Jul 24, 2013 at 7:27
  • u can sort for the newest one.
    – monymirza
    Jul 24, 2013 at 7:36
  • thanks for your reply. grouping and sorting works well, but I was not able to limit the displayed nodes to just one per group. I ended up using this: drupal.org/project/views_limit_grouping Jul 24, 2013 at 10:39
1

Desired solution implemented using the Views Grouping Row Limit module. Here is a quote about it (from the module's project page):

This is a basic Views style plugin that allows for a limit on the number of rows displayed within a grouping field ...

To use this module, simply change the style plugin for your view to the "Grouping Field (with Limit)" option. You will then be presented with options to choose your limit and offset (the offset just controls what row to start on, e.g. an offset of 1 would omit the first row from each grouping field). Please note that in order for this to take effect, you must set your row limit on the actual view to Unlimited.

0

https://drupal.org/project/views_field_view might be the solution to your issue. Granted it must be used with caution as it adds some extra overhead but ultimately it grants the SELECT FROM SELECT query that solves your problem.

Your Answer

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

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