views

Drupal Views Group by Field with Counts and Links - A Better Way

Alas, I came across a better way to take a bunch of rows from views, group them by a particular field, and provide a count for each.

Here is a basic example for Drupal 6 (probably very similar for Drupal 7).

Basic Settings

Style: HTML List

Fields

Node id (exclude from display)

Node title

Arguments

Node title

Drupal Views Group by Field with Counts

Note, since writing this article I learned about Views Arguments 'action to take if argument not present' summary list with counts... it is definitely easier than the approach I documented below. I'll leave what I have done below because I'm not sure the summary list option will handle all cases. Someday I'll update this post to include a tutorial on how to use the aformentioned approach, someday.

Drupal How to Theme a Views Exposed Filter Form

To theme the exposed filter form on a view in Drupal:

Programmatically Display a Certain Page of Data with Drupal Views

Here is how you can programmatically load a Drupal view, then specify a particular page of data to show, then print out the view.

$what_page_to_show = 10;
$view = views_get_view('my_example_view');
$view->pager['current_page'] = $what_page_to_show;
print $view->preview();

Pages

Subscribe to RSS - views