Figured it out, just used the function generate_calendar instead of using it as a class. However, for some reason the event days that I created in march, show up for the same days in the other months?? Is it something to do with:
if($row['month'] == $month)
{
$day = $row['day'];
$days[$day] = array('events.php?action=view&id='.$row['id'], 'linked-day');
}
Full code:
<?php
include 'calendar.php';
include 'config.php';
$time = time();
$today = date('j',$time);
$month = date('n');
$year = date('Y');
$events = mysql_query("SELECT *, DATE_FORMAT(date, '%M %e, %Y %h:%m:%s') as
date, DATE_FORMAT(date, '%c') as month, DATE_FORMAT(date, '%e') as day FROM calevents order by date desc") or die(mysql_error());
if($events)
{
$days = array();
while($row = mysql_fetch_array($events))
{
if($row['month'] == $month)
{
$day = $row['day'];
$days[$day] = array('events.php?action=view&id='.$row['id'], 'linked-day');
}
}
}
echo "<table style=\"margin: auto\">";
echo "<tr>";
for($month=1; $month<=12; $month++){
echo "<td style=\"vertical-align: top\">";
echo generate_calendar($year, $month,$days,3);
echo "</td>";
if($month%3 == 0 and $month<12){
echo "</tr><tr>";
}
}
echo "</tr>";
echo "</table>";