I am creating a calendar without jquery calendar plugin. I could retrieve the data which is in the database to the calendar. But when there are multiple data per day only on
If you want to show all four boxes for the dates which has data, try to change the get_calendar_data() foreach as below,
$content = "";
$lastDay = -1;
$index = 0;
foreach ($query->result() as $row) {
if($lastDay != intval(substr($row->date_cal, 8, 2))){
if($index > 0 ){
if($content != ''){
$cal_data[$lastDay] = $content;
$content = '';
}
}
$index = 0;
}
if ($row->title == 'GK' && $row->type == 'AM') {
$content .= '<div class="gk_am">' . $row->title . ' ' . $row->type . '</div>';
} else if ($row->title == 'GK' && $row->type == 'PM') {
$content .= '<div class="gk_pm">' . $row->title . ' ' . $row->type . '</div>';
}else if ($row->title == 'RP' && $row->type == 'AM') {
$content .= '<div class="rp_am">' . $row->title . ' ' . $row->type . '</div>';
} else if ($row->title == 'RP' && $row->type == 'PM') {
$content .= '<div class="rp_pm">' . $row->title . ' ' . $row->type . '</div>';
}
$lastDay = intval(substr($row->date_cal, 8, 2));
$index++;
}
if($lastDay != -1 && $content != ''){
$cal_data[$lastDay] = $content;
}
Let me know whether it works now or not.