Hello everyone,
Here is a code which gives the calendar of the whole year, with the current date in dark green and in big font.
Hope you like it:
<html>
<head>
<title>Calendar</title>
</head>
<body>
<?php
$year = date("Y");
$months = array (1,2,3,4,5,6,7,8,9,10,11,12);
$todaydate = date("j");
$todaymonth = date("n");
$z = 1;
?>
<h1>Calendar for the year of <?php print $year;?></h1>
<table>
<tr>
<?php
foreach($months as $month) {
print "<td>";
$dates = "";
$mont = mktime(0,0,0,$month,1,$year);
$monthname = date("F",$mont);
print "<BR>";
$x1 = 1;
include("trial3.php");
while($x1<=$nd) {
$dates[$x1]=$x1;
$x1++;
}
$fday = date("w",mktime(0,0,0,$month,1,$year));
$x = $fday;
?>
<table height = 70 width = 35 cellpadding = 0 cellspacing = 0 border = 0>
<tr height = 20><td width = 80 bgcolor = maroon><font size = 2.5 color = white><b><?php print "$monthname"; ?></td></tr>
<tr>
<td width = 70>
<table height = 70 cellpadding = 1 border = 0 bgcolor = black>
<tr height = 10 bgcolor = dodgerblue>
<td width=10><b><font size = 2.5 color = white><center>Sun</center></b></td>
<td width=10><b><font size = 2.5 color = white><center>Mon</b></td>
<td width=10><b><font size = 2.5 color = white><center>Tue</b></td>
<td width=10><b><font size = 2.5 color = white><center>Wed</b></td>
<td width=10><b><font size = 2.5 color = white><center>Thu</b></td>
<td width=10><b><font size = 2.5 color = white><center>Fri</b></td>
<td width=10><b><font size = 2.5 color = white><center>Sat</b></td>
</tr>
<tr height = 10 bgcolor = white>
<?php
foreach($dates as $val) {
if($fday < 7) {
if($val == 1) {
while ($x>0) {
print "<td width=10> </td>";
$x--;
}
if(($val == $todaydate) && ($month == $todaymonth)) {
print "<td width=10><font size = 3 color = 'forestgreen'><center><b>".$val."</center></td>";
}else{
print "<td width=10><font size = 2.5><center>".$val."</center></td>";
}
$fday++;
}else{
if ($fday < 7) {
if(($val == $todaydate) && ($month == $todaymonth)) {
print "<td width=10><font size = 3 color = 'forestgreen'><center><b>".$val."</center></td>";
}else{
print "<td width=10><font size = 2.5><center>".$val."</center></td>";
}
$fday += 1;
}
}
}else{
$fday = 0;
print "</tr>";
print "<tr height = 5 bgcolor = white>";
if($fday < 7) {
if(($val == $todaydate) && ($month == $todaymonth)) {
print "<td width=10><font size = 3 color = 'forestgreen'><center><b>".$val."</center></td>";
}else{
print "<td width=10><font size = 2.5><center>".$val."</center></td>";
}
$fday++;
}
}
}
print " </tr>
</table>
</td>
</tr>
</table> ";
$y = 6;
$div = (($z)/(6));
if($div == 1) {
print "</td></tr>
<tr>";
}
$z++;
}
?>
</td>
<?php
?>
</tr>
</table>
</body>
</html>
Cheers