Salve a tutti,
ho scaricato lo script di un calendario perpetuo...
tutto bene finchè stai al mese corrente...
quando visualizzi il mese successivo o il precedente il primo giorno del mese non è in sequenza.
Purtroppo non sono esperta, mi potete aiutare?!
ecco il codice:
Codice PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>PHP CSS Calendar Example</title>
<link href="calendar.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h3>PHP CSS Calendar Example</h3>
<table id="calendar" cellspacing="0" cellpadding="0" summary="This month's calendar">
<?php
$day = @$_GET["day"];
$month = @$_GET["month"];
$year = @$_GET["year"];
if ($month == ""){
$day = date('d');
$month = date('n');
$year = date('Y');
}
$firstOfMonthDateStamp = mktime(12, 59, 59, $month, 1, $year);
$daysInCurrentMonth = date("t", $firstOfMonthDateStamp);
$firstOfMonthDay = date("d", $firstOfMonthDateStamp);
$lastOfMonthDay = date("w", strtotime(date("n",$firstOfMonthDateStamp)."/".$daysInCurrentMonth."/".date("Y",$firstOfMonthDateStamp)));
$previousMonth = getdate(strtotime('-1 month', $firstOfMonthDateStamp));
$nextMonth = getdate(strtotime('+1 month', $firstOfMonthDateStamp));
?>
<caption>[url="calendar.php?day=<?php echo $day ?>&month=<?php echo $previousMonth['mon'] ?>&year=<?php echo $previousMonth['year'] ?>"])"><<[/url] <?php echo date("F", $firstOfMonthDateStamp) ?> <?php echo date("Y",$firstOfMonthDateStamp) ?> [url="calendar.php?day=<?php echo $day ?>&month=<?php echo $nextMonth['mon'] ?>&year=<?php echo $nextMonth['year'] ?>"])">>>[/url]</caption>
<tr><th abbr="Sunday" title="Sunday">S</th><th abbr="Monday" title="Monday">M</th><th abbr="Tuesday" title="Tuesday">T</th><th abbr="Wednesday" title="Wednesday">W</th><th abbr="Thursday" title="Thursday">T</th><th abbr="Friday" title="Friday">F</th><th abbr="Saturday" title="Saturday">S</th></tr>
<tr>
<?php
//ASP/PHP WRITTEN BY BOB MCKAY, [url]WWW.FRESHMANGO.COM[/url] - USE AS YOU WISH BUT PLEASE LEAVE THIS IN PLACE
//DESIGN, CSS AND XHTML ALL BY VEERLE, [url]HTTP://VEERLE.DUOH.COM[/url]
$columnCounter = 0;
//FOR fillLeadingEmptyDays = 1 TO ($firstOfMonthDay - 1)
for ($fillLeadingEmptyDays=0; $fillLeadingEmptyDays <= ($firstOfMonthDay - 1); $fillLeadingEmptyDays+=1) {
$columnCounter = $columnCounter + 1;
echo "<td></td>";
}
for ($enterDays=1; $enterDays <= $daysInCurrentMonth; $enterDays+=1) {
$columnCounter = $columnCounter + 1;
echo "<td><a ";
if ($enterDays == $day) { echo " class = \"today\""; }
$dayLinkDestination = "#";
echo " href=\"".$dayLinkDestination."\">".$enterDays."</a></td>";
if ( $columnCounter == 7 ) {
echo "</tr><tr>";
$columnCounter = 0;
}
}
for ($fillEmptyDays=($columnCounter + 1); $fillEmptyDays <= 7; $fillEmptyDays+=1) {
if ($columnCounter ==0) {
break;
}
echo "<td></td>";
}
?></tr>
</table>
</body>
</html>