Ok so if you visit www.flog-it.ie you will be taken to index.php which calls the file main.php and displays the categories etc in the middle. Well we now have an events page which is the index.php file (renamed to events.php) which calls another file called events1.php to the middle instead of main. Now this events1.php contains the upcoming_events.inc.php file and the calendar of events also which we have but as you can see on the website its not working for me! Please help!
Heres the files that you will need.
events1.php
<img src="images/whats-on.png" width="150" height="45" alt="Whats On" />
<?php
require_once("config.inc.php");
?>
<table border="0" cellspacing="0" cellpadding="3" width="98%" class="dir"><tr>
<table width="525" height="60" border="0">
<tr>
<td><?php include("caltest.php"); ?></td>
</tr>
</table>
<table width="525" height="60" border="0">
<tr>
<td><?php include("upcoming_events.inc.php"); ?></td>
</tr>
</table>
calendar.cls.php
<?php
class calendar
{
function display($urlformat, $weekday_start=0, $weekdays="", $months="", $year=0, $month=0, $specialdates="", $cellwidth=20)
{
// Get year and month
if($year && $month)
{
$day = date("d");
$t = mktime(0, 0, 0, $month, $day, $year);
if($year == date("Y") && $month == date("m")) $highlighttoday = TRUE;
}
else
{
$year = date("Y");
$month = date("m");
$day = date("d");
$t = time();
$highlighttoday = TRUE;
}
// Save year and month
//setcookie("_xzcal_m", $month);
//setcookie("_xzcal_y", $year);
// Get weekday and month names
if(!$weekdays)
{
$weekdays = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
}
if(!$months)
{
$months = array("January","February","March","April","May","June","July","August","September","October","November","December");
}
$weekdays_small = array();
foreach($weekdays as $k=>$wd)
{
$weekdays_small[$k] = substr($wd, 0, 1);
if(ord($weekdays_small[$k]) >= 128) $weekdays_small[$k] .= substr($wd, 1, 1);
}
// Calendar title
$caltitle = $months[$month-1] . " " . $year;
// Prev and next month links
if ($month == 1)
{
$prev_month = 12;
$prev_month_year = $year-1;
}
else
{
$prev_month = $month-1;
$prev_month_year = $year;
}
if ($month == 12)
{
$next_month = 1;
$next_month_year = $year+1;
}
else
{
$next_month = $month+1;
$next_month_year = $year;
}
$month_link = "?";
$qsA = $_GET; unset($qsA['_xzcal_m'], $qsA['_xzcal_y']);
foreach($qsA as $k=>$v) $month_link .= "$k=$v&";
$prev_month_link = $month_link . "_xzcal_m=$prev_month&_xzcal_y=$prev_month_year";
$next_month_link = $month_link . "_xzcal_m=$next_month&_xzcal_y=$next_month_year";
$cal = <<< EOB
<table cellspacing="1" border="0" cellpadding="0" class="calendar">
<tr>
<td class="cal_header_month"><a href="$prev_month_link">«</a></td>
<td colspan="5" class="cal_header_month">$caltitle</td>
<td class="cal_header_month"><a href="$next_month_link">»</a></td>
</tr>
<tr>
EOB;
// Weekdays
$j = $weekday_start;
for ($i=0; $i<7; $i++)
{
$wds = $weekdays_small[$j];
$cal .= <<< EOB
<td class="cal_header_week" width="$cellwidth">$wds</td>
EOB;
$j++;
if ($j==7) $j=0;
}
$cal .= <<< EOB
</tr>
EOB;
// Days
$firstday_weekday = date("w", mktime(0, 0, 0, $month, 1, $year));
$empty_cells = ($firstday_weekday >= $weekday_start) ?
($firstday_weekday - $weekday_start) :
7 - $weekday_start;
if ($empty_calls) $cal .= "<tr>";
for ($i=0; $i<$empty_cells; $i++)
$cal .= "<td> </td>";
$lastday = date("t", $t);
//$datepre = date("Y-m-", $t);
$today = date("j", $t);
for ($d=1; $d<=$lastday; $d++, $i++)
{
$url = $urlformat;
$url = str_replace("{@T}", mktime(0, 0, 0, $month, $d, $year), $url);
$url = str_replace("{@D}", str_pad($d, 2, "0", STR_PAD_LEFT), $url);
$url = str_replace("{@M}", $month, $url);
$url = str_replace("{@Y}", $year, $url);
$url = str_replace("{@W}", $i, $url);
if ($i%7==0) $cal .= "<tr>";
$cal .= "<td";
if ($d == $today && $highlighttoday) $cal .= " id=\"today\"";
if ($specialdates[$d]) $cal .= " class=\"content_date\"";
$cal .= "><a href=\"$url\">$d</a></td>";
if ($i%7==6) $cal .= "</tr>";
}
if ($i%7 != 0)
{
for(; $i%7!=0; $i++) $cal .= "<td> </td>";
}
$cal .= "</tr></table>";
echo $cal;
}
}
?>
caltest.php
<?php
include("calendar.cls.php");
$url = "page?day={@D}";
calendar::display($url, 0);
?>