I have a view that outputs a list of nodes and their taxonomy terms. I use taxonomy field as grouping field. So I get:

Tax1 (article1, article2, article3 )
Tax2 (article4, article5, article6 )
Tax3 (article7, article8, article9 )


View makes markup for each group like this:

<div class="view-grouping">
<div class="view-grouping-header">
<div class="view-grouping-content">
<div class="views-row views-row-1"></div>
<div class="views-row views-row-2"></div>
<div class="views-row views-row-3"></div>


How is it possible to output every second grouping?

I would like to have 2 columns with 2 views, first view would output every second grouping and second view would show other groupings.

I'm using Views 3.

  • What version of Views? – Coleman Oct 28 '14 at 19:02
  • @Coleman views 3 – loparr Oct 28 '14 at 19:03

This seems like a good use-case for a theme override.

If you click the "advanced" section in the view and click "Theme Information" at the bottom, you'll get a list of theme names. Click on "Style output" and copy the code, and paste it into a file in your theme folder with the most specific name possible (at the end of the list starting with "views-view-unformatted.tpl.php").

Not sure if there's a more elegant way to get a row count (it doesn't seem to be an available tpl variable) but you can DIY like so:

  <?php function count_this_view() {
    static $count = 0;
    return $count++;

Then wrap your tpl in a conditional like

  <php if (count_this_view() % 2) :?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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