Hello,
Can someone please show me how to modify the event calendar below to show the current day highlighted in a different color and days with events added in a different color from the rest of the displayed days? The script has a second part that interfaces with a MySql table that stores the events. I am very new to this. Thanks.
<?php
echo "
<head>
<LINK REL=stylesheet HREF='cal.css' TYPE='text/css'>
<STYLE TYPE-'type/css'>
<!--
body { background: #6898D0 }
body { font-family: Verdana, Arial, Helvetica; font-size: 10pt; font-weight: bold; font-color: #FFFFFF }
A:hover { color: #80FF80; text-decoration: underline }
A:link { color: #00FF33 }
A:visited { color: #00FF33 }
table { border-color: black; border-width: 1px }
table { font-family: Verdana, Arial, Helvetica; font-size: 7pt; font-weight: bold; font-color: #FFFFFF }
tr { border-color: black; border-width: 1px }
td { border-color: black; border-width: 1px }
-->
</STYLE>
<body>
<center>
";
// Check for a Month Change submission
if ($submit) {
// Subtract one from the month for previous, add one for next
if ($submit == "Prev") {
$month_now--;
} else {
$month_now++; }
$date = getdate(mktime(0,0,0,$month_now,1,$year_now));
} else {
$date = getdate();
}
$month_num = $date["mon"];
$month_name = $date["month"];
$year = $date["year"];
$date_today = getdate(mktime(0,0,0,$month_num,1,$year));
$first_week_day = $date_today["wday"];
$cont = true;
$today = 27;
while (($today <= 32) && ($cont)) {
$date_today = getdate(mktime(0,0,0,$month_num,$today,$year));
if ($date_today["mon"] != $month_num) {
$lastday = $today - 1;
$cont = false;
}
$today++;
}
// calendar table-top and days of the week columns
// allow for form submission to the script for forward and backwards
echo"
<table width=\"160\" border=\"1\" cellspacing=0 cellpadding=2>
<tr bgcolor=999FFF><td align=left><A href='/calendar/cal.php?month_now=$month_num&year_now=$year&submit=Prev'><</A></td><td colspan=\"5\" align=center>$month_name $year</td><td align=right><A href='/calendar/cal.php?month_now=$month_num&year_now=$year&submit=Next'>></A></td></tr>
<tr><td>S</td><td>M</td><td>T</td><td>W</td><td>T</td><td>F</td><td>S</td></
tr>";
// begin placement of days according to their beginning weekday
$day = 1;
$wday = $first_week_day;
$firstweek = true;
while ( $day <= $lastday) {
if ($firstweek) {
echo "<TR>";
for ($i=1; $i<=$first_week_day; $i++) {
echo "<TD> </td>";
}
$firstweek = false;
}
if ($wday==0) {
echo "<tr>";
}
// make each day linkable to the following result.php page
if ( intval($month_num) < 10) { $new_month_num = "0$month_num"; } //leading zero to month below 10
elseif (intval($month_num) >= 10) { $new_month_num = $month_num; } //no zero above 10
if ( intval($day) < 10) { $new_day = "0$day"; } //leading zero to dat below 10
elseif (intval($day) >= 10) { $new_day = $day; } //no zero above 10
$link_date = "$year-$new_month_num-$new_day";
echo "<td><a href=results.php?eventid=$link_date> $day </a></td>";
if ($wday==6) {
echo "</tr>\n";
}
$wday++;
$wday = $wday % 7;
$day++;
}
echo"
</table>
</body>
";
?>