$date = array(); foreach ($cal_dates as $key => $row) { $date[$key] = $row['sortDate']; } if ($order) { array_multisort($date, SORT_ASC, $cal_dates); } else { array_multisort($date, SORT_DESC, $cal_dates); } } /* beginning of Sorting */ /* Beginning of Calendar Output Code */ if ($display == 'calendar') { $cal = new Calendar_Events($year, $month); /*Calendar Parser parameters */ $cal->setDayNameFormat('%a'); $cal->url = $this_page; if ($template) { $cal->tpl['calendar'] = file_get_contents($basePath . 'templates/' . $template . '/calendar.tpl'); $cal->tpl['dayNoEvent'] = file_get_contents($basePath . 'templates/' . $template . '/dayNoEvent.tpl'); $cal->tpl['dayWithEvent'] = file_get_contents($basePath . 'templates/' . $template . '/dayWithEvent.tpl'); $cal->tpl['eachEvent'] = file_get_contents($basePath . 'templates/' . $template . '/eachEvent.tpl'); $cal->tpl['notInMonth'] = file_get_contents($basePath . 'templates/' . $template . '/notInMonth.tpl'); } else { $cal->tpl['calendar'] = file_get_contents($basePath . 'templates/default/calendar.tpl'); $cal->tpl['dayNoEvent'] = file_get_contents($basePath . 'templates/default/dayNoEvent.tpl'); $cal->tpl['dayWithEvent'] = file_get_contents($basePath . 'templates/default/dayWithEvent.tpl'); $cal->tpl['eachEvent'] = file_get_contents($basePath . 'templates/default/eachEvent.tpl'); $cal->tpl['notInMonth'] = file_get_contents($basePath . 'templates/default/notInMonth.tpl'); } if ($cal_dates) {