Welcome Guest, Not a member yet? Register   Sign In
generate 12 mini-calendars

Why doesn't this work? It clearly generates [what appears to be correct when echoed] 12 incremented $this->calendar->generate(Year, month) statements, but every calendar is the default (current) month in the correct year. In other words, it is correctly reading the year and correctly incrementing the month... it is just not reading the month.

More to the point, I guess, is there an easier way to do this?

function get_months($date1, $date2)

$date1 = date('Y-m',strtotime($date1));
$date2 = date('Y-m',strtotime($date2));

if($date1 < $date2)
   $past = $date1;
   $future = $date2;
   $past = $date2;
   $future = $date1;

$months = array();
for($i = $past; $past<=$future; $i++)
   $timestamp = strtotime($past.'-1');
   $months[] = date('Y, m',$timestamp);
   $past = date('Y-m',strtotime('+1 month',$timestamp));  

return $months;

$this_year = date('Y-m', strtotime('now'));
$next_year = date('Y-m', strtotime('now +12 months'));

$data = get_months($this_year, $next_year);

     echo $this->calendar->generate($data[$i]);
     echo 'generate('.$data[$i].')<br />';

I was hoping someone might attempt to answer this question. Is it a limitation of the Calendar Helper?

Theme © iAndrew 2016 - Forum software by © MyBB