eKiwi

Kalender anzeigen

Gibt den aktuellen Monat in Kalenderform aus.

Beispiel:

Oktober 2014
MoDiMiDoFrSaSo
  1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31

Die Funktion:

<?php
// *** START Monatskalender ***
$monat=date("n");
$jahr=date("Y");
$erster=date("w", mktime(0,0,0,$monat,1,$jahr));
$insgesamt=date("t");
$heute=date("d");
$monate=array("Januar","Februar","M&auml;rz","April","Mai",
              
"Juni","Juli","August", "September","Oktober",
              
"November","Dezember");
if(
$erster==0){$erster=7;}
echo
"<table border=\"0\" style=\"font-size:8pt; font-family:Verdana\">\n";
echo
"<th colspan=\"7\" align=\"center\" style=\"font-size:12pt; font-family:Arial; color:#ff9900;\">"
      
.$monate[$monat-1]." ".$jahr."</th>";
echo
"<tr>\n<td style=\"color:#666666\"><b>Mo</b></td><td style=\"color:#666666\"><b>Di</b></td>";
echo
"<td style=\"color:#666666\"><b>Mi</b></td><td style=\"color:#666666\"><b>Do</b></td>";
echo
"<td style=\"color:#666666\"><b>Fr</b></td><td style=\"color:#0000cc\"><b>Sa</b></td>";
echo
"<td style=\"color:#cc0000\"><b>So</b></td></tr>\n";
echo
"<tr>\n";
$i=1;
while(
$i<$erster){echo "<td>&nbsp;</td>"; $i++;}
$i=1;
while(
$i<=$insgesamt)
{
$rest=($i+$erster-1)%7;
if(
$i==$heute){echo "<td style=\"font-size:8pt; font-family:Verdana; background:#ff0000;\" align=center>";}
else{echo
"<td style=\"font-size:8pt; font-family:Verdana\" align=center>";}
if(
$i==$heute){echo "<span style=\"color:#ffffff;\">$i</span>";}
else if(
$rest==6){echo "<span style=\"color:#0000cc\">$i</span>";}
else if(
$rest==0){echo "<span style=\"color:#cc0000\">$i</span>";}
else{echo
"$i";}
echo
"</td>\n";
if(
$rest==0){echo "</tr>\n<tr>\n";}
$i++;
}
echo
"</tr>\n";
echo
"</table>\n";
// *** ENDE Monatskalender ***
?>




comments powered by Disqus

Copyright Dunkel & Iwer GbR - Alle Rechte vorbehalten