Ein einfacher Kalender :) Viel Spass damit wünscht eg0l
<?php
$time = time();
$months = array("Januar", "Februar", "März", "April", "Mai", "Juni",
"Juli", "August", "September", "Oktober", "November", "Dezember");
$days = date("t", $time);
$month = $months[date("n", $time)-1];
$first_day = date("w", mktime(0, 0, 0, date("n", $time), 1, date("Y", $time)));
if($first_day == 0) {
$first_day = 6;
} else {
$first_day = $first_day-1;
}
$rest = $days-(7-($first_day+1));
$zeilen = ceil($rest/7);
$aktuell = date("dmY");
$last_day = date("w", mktime(0, 0, 0, date("n", $time), date("t", $time), date("Y", $time)));
if($last_day == 0) {
$zeilen = $zeilen-1;
}
?>
<table cellpadding="2" cellspacing="0" style="font-family: Arial">
<tr>
<td colspan="7" style="font-weight:bold;" bgcolor="orange"><?php echo $month; ?></td>
</tr>
<tr>
<th>Mo</th>
<th>Di</th>
<th>Mi</th>
<th>Do</th>
<th>Fr</th>
<th>Sa</th>
<th>So</th>
</tr>
<?php
for($zeile=0;$zeile<=$zeilen;$zeile++) {
echo "<tr>";
if($zeile == 0) {
for($i=0;$i<$first_day;$i++) {
echo "<td> </td>";
}
$start = 1;
$ende = 7-$first_day;
} else {
$start = $ende + 1;
$ende = $start + 6;
if($ende > $days)
$ende = $days;
}
for($i=$start;$i<=$ende;$i++) {
unset($bg);
if($aktuell == date("dmY", mktime(0,0,0,date("n",$time),$i,date("Y", $time)))) {
$bg = " bgcolor=\"#FFFF7D\"";
}
echo "<td".$bg." align=\"right\">".$i."</td>";
}
$b = 6-($ende-$start);
if($zeile == $zeilen && $b>0) {
for($g=0;$g<$b;$g++) {
echo "<td> </td>";
}
}
echo "</tr>\n";
}
echo "</table>";
?>