Is there any way to view multiple months at a time like year view? For example, I will set a start month like September 2011 and number of displayed months like 7.


joppert’s picture

Anyone any idea?

JordiTR’s picture


I've had to face the same problem and I've tried to find information on the calendars issue list. As long as I'm doing it on the last drupal 7 calendar version I'm not sure how it extends to drupal 6. To put it in short finally I realized that I could trick the year view in a block and after it overwrite the block template. So:

  1. create a new block display on your view
  2. select year visualization
  3. add date argument based on today and choose year granularity
  4. go to the theme section on views and override the alternative style for "calendar-year.tpl.php" (you'll find plenty of tutorials on how to do that in case you don't know)

Then I've overwritten the block template like this:

<div class="months-3-view">
<div class="month-1"><?php print $months[1] ?></div>
<div class="month-2"><?php print $months[2] ?></div>
<div class="month-3"><?php print $months[3] ?></div>

Probably on novembre is not going to show the newt three monts, but only two because of the "year granularity" argument, but I'm not completely sure. I hope it can help others.

Meanwhile I hope the calendar coders may someday provide a new display mode on that fashion :-)

JordiTR’s picture


the overriden was partially good, it was not taking "current months", but just "fixed". Now it works better:

<div class="view-3-months">
<?php $num_month = date('n'); ?>
<div class="month-1"><?php print $months[$num_month] ?></div>
<div class="month-2"><?php print $months[$num_month + 1] ?></div>
<div class="month-3"><?php print $months[$num_month + 2] ?></div>

It's not going to work when it arrives to november, because the last month it's goint to dissapear and the last 2 months on december. That's because this views preview is considering the whole year as an argument. We still need a calendar views display mode were we could define the first month and number of months ahead.

I leave here that information for anyone that could find it helpful.