Cyclic formatting based on date..

On one of my pages, I'm listing items by date. What I'd like to do is change the formatting when the month changes. What's a good way to do this? I've read the bit about partials to cycle through formatting for alternate rows, but what about arranging it by month?


<In format 1>
  Sep 23
  Sep 12
  Sep 1
<In format 2>
  Aug 12
  Aug 4
<In format 3>
  Jul 31
  Jul 25

<<Prev Page>> | <<Next Page >>


To alternate back and forth based on month

<div class="month<%= [month number]%2).to_s %>">

That will return either "month0" or "month1".

Then set the styles for .month0 and .month1 in your css


Mohit Sindhwani wrote: