Gaijin.at -
Tip: Do you want be informed about application news and updates?
Use the RSS NewsFeed of Gaijin.at with the portable NFReader.

PHP Monthly Calendar

This PHP script displays a monthly calendar and highlights the current day.

This calendar is ideal for integrating it into portal pages or in a small window on the homepage.

Example

Monthly Calendar

Required

PHP 4.0.4 or higher

License

Open Source (GNU GPL)

Sourcecode

<?php
$monat
=date('n');
$jahr=date('Y');
$erster=date('w'mktime(0,0,0,$monat,1,$jahr));
$insgesamt=date('t'mktime(0,0,0,$monat,1,$jahr));
$heute=date('d');
$monate=array('January','February','March','April','May','June','July','August','September','October','November','December');
if(
$erster==0){$erster=7;}
echo 
'<table border=0 style="font-size:8pt; font-family:Verdana">';
echo 
'<th colspan=7 align=center style="font-size:12pt; font-family:Arial; color:#ff9900;">'.$monate[$monat-1].' '.$jahr.'</th>';
echo 
'<tr><td style="color:#666666"><b>Mo</b></td><td style="color:#666666"><b>Tu</b></td>';
echo 
'<td style="color:#666666"><b>We</b></td><td style="color:#666666"><b>Th</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>';
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><tr>';}
$i++;
}
echo 
'</tr>';
echo 
'</table>';
?>

Beta Area | Search | Webmasters | Support | Contact
Copyright © 2003-2010 Gaijin.at