[eluser]opel[/eluser]
I have this in my model :
Code:
function calendarDates($year, $month)
{
$query = $this->db->query(" SELECT blog_id, blog_title, blog_posted FROM blog WHERE YEAR(blog_posted) = ".$year." AND MONTH(blog_posted) = ".$month." ORDER BY blog_posted ASC");
$dates = array();
foreach ($query->result_array() as $key => $value)
{
$dates[$key] = $value;
}
return $dates;
}
And this in my controller :
Code:
//Get article dates
$dates = $this->blog_model->calendarDates($year, $month);
//Create array for calendar
foreach ($dates as $article)
{
//$calendar_dates[date("d",strtotime($article['posted']))] = base_url()."blog/month/".date("Y",strtotime($article['posted']))."/".date("d",strtotime($article['posted']))."/";
$calendar_dates[date("j",strtotime($article['blog_posted']))] = base_url()."blog/article/".url_title($article['blog_title'])."/".$article['blog_id']."/";
}
return $this->calendar->generate($year, $month, $calendar_dates);