0

I'm working on a project where the user wants to display upcoming shows. They want to display these shows in three blocks. Each block would list shows for the nearest month, in order.

For example, if the the current month is January, and the upcoming shows were in February, April and June each block would list the shows in the month. (Block 1 = February, Block 2 = April, Block 3 = June)

I was originally thinking of creating three block views. I would filter the first view's date field so that it is equal to the month, the second view's date field so that it is one more than the month, and the third view's date field so that it is two more than the month.

However, since the client's shows are not every month, the shows would only appear until they fit that specific filter. The example above would not show any upcoming shows until it was February, and would leave the second and third columns blank.

All I could think of was to create a block view for each month, but the client would have to arrange them every month.

1 Answer 1

0

I can't think of a 'clean' way of doing it within the Drupal interface, but it should be doable by using a template. An override of views-view-table.tpl.php (or the list version of that) and then test the dates as they come through. It would be a little tricky to know which block has been previously put up (and therefore where to start the next block) but I think it is possible.

In more detail.

  • Create a view with the listing that you want (for all months).
  • Create three blocks within that view (they can be the same).
  • Using the Theme Information tab, find the name of the template that handles the rendering of the rows.
  • Put code in that template to only take a months worth of dates at a time.
  • Set a flag that 'Feb' is done, so next iteration will be 'Apr'.

Your Answer

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

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