This droplet generates a nifty month calender.
Code is taken from
http://keithdevens.com/software/php_calendar#examplesIt can do loads with calenders.
Used variables:
$year , $month , $days = array() , $day_name_length = 3 , $month_href = NULL , $first_day = 0 , $pn = array())
generate_calendar returns a string containing the output HTML. $year and $month are obvious. However, a neat side effect of using PHP's mktime function internally is that generate_calendar does "date rounding". So, basically, if you try to do month 13 of 2002, it'll round to January of 2003. See the documentation for mktime.
$days is an optional array that can contain information you want to specify for each day, including a location to link that day to, a stylesheet class for that day, and any content you want to appear for that day of the calendar. For example, an array passed for the days parameter might look something like this:
<?php
$days = array(
2=>array('/weblog/archive/2004/Jan/02','linked-day'),
3=>array('/weblog/archive/2004/Jan/03','linked-day'),
8=>array('/weblog/archive/2004/Jan/08','linked-day'),
22=>array('/weblog/archive/2004/Jan/22','linked-day'),
);
?> Each key corresponds to the day of the month, and each value is an array containing one to three elements. The first element is the location you want the day to link to, the second element is a space-separated list of classes (for stylesheets), and the third element is content that you want to appear in that day's cell, instead of just the day's number.
$day_name_length (optional, defaults to 3) is the number of characters to show for the day name ("Monday", "Tuesday", etc.). If you choose zero, the day headings don't display at all, and if you choose >3 it displays the whole name of the day.
$month_href is the location you'd like the month to be a link to (optional).
$first day is the number of the day you want your weeks to start on. Sunday is 0, Monday is 1, etc. Defaults to 0, hence Sunday.
$pn contains the links for the previous and next months to link to (hence, 'pn'). It should be in the following format: $pn = array('<'=>'prev-link','>'=>'next-link'); Note that it's not necessary that the key for next and previous be < (<) and > (>). They could also be things like ← (←) and → (→) or « («) and » (»). In addition, it's important that you define them in the order just shown (previous before next in the array). If you just want to have a previous link, just define the first. If you just want to have a next link, you must define the first with a NULL key and then define the second. If one of the "directions" is defined but the link field is blank, the key (such as < or >) will still be shown, but it won't be a link.
See
http://keithdevens.com/software/php_calendar#examples for original script
I just made a droplet out of this one

<?php
/* Used variables:
$year , $month , $days = array() , $day_name_length = 3 , $month_href = NULL , $first_day = 0 , $pn = array()
*/
$first_of_month = gmmktime(0,0,0,$month,1,$year);
#remember that mktime will automatically correct if invalid dates are entered
# for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998
# this provides a built in "rounding" feature to generate_calendar()
$day_names = array(); #generate all the day names according to the current locale
for($n=0,$t=(3+$first_day)*86400; $n<7; $n++,$t+=86400) #January 4, 1970 was a Sunday
$day_names[$n] = ucfirst(gmstrftime('%A',$t)); #%A means full textual day name
list($month, $year, $month_name, $weekday) = explode(',',gmstrftime('%m,%Y,%B,%w',$first_of_month));
$weekday = ($weekday + 7 - $first_day) % 7; #adjust for $first_day
$title = htmlentities(ucfirst($month_name)).' '.$year; #note that some locales don't capitalize month and day names
#Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03
@list($p, $pl) = each($pn); @list($n, $nl) = each($pn); #previous and next links, if applicable
if($p) $p = '<span class="calendar-prev">'.($pl ? '<a href="'.htmlspecialchars($pl).'">'.$p.'</a>' : $p).'</span> ';
if($n) $n = ' <span class="calendar-next">'.($nl ? '<a href="'.htmlspecialchars($nl).'">'.$n.'</a>' : $n).'</span>';
$calendar = '<table class="calendar">'."\n".
'<caption class="calendar-month">'.$p.($month_href ? '<a href="'.htmlspecialchars($month_href).'">'.$title.'</a>' : $title).$n."</caption>\n<tr>";
if($day_name_length){ #if the day names should be shown ($day_name_length > 0)
#if day_name_length is >3, the full name of the day will be printed
foreach($day_names as $d)
$calendar .= '<th abbr="'.htmlentities($d).'">'.htmlentities($day_name_length < 4 ? substr($d,0,$day_name_length) : $d).'</th>';
$calendar .= "</tr>\n<tr>";
}
if($weekday > 0) $calendar .= '<td colspan="'.$weekday.'"> </td>'; #initial 'empty' days
for($day=1,$days_in_month=gmdate('t',$first_of_month); $day<=$days_in_month; $day++,$weekday++){
if($weekday == 7){
$weekday = 0; #start a new week
$calendar .= "</tr>\n<tr>";
}
if(isset($days[$day]) and is_array($days[$day])){
@list($link, $classes, $content) = $days[$day];
if(is_null($content)) $content = $day;
$calendar .= '<td'.($classes ? ' class="'.htmlspecialchars($classes).'">' : '>').
($link ? '<a href="'.htmlspecialchars($link).'">'.$content.'</a>' : $content).'</td>';
}
else $calendar .= "<td>$day</td>";
}
if($weekday != 7) $calendar .= '<td colspan="'.(7-$weekday).'"> </td>'; #remaining "empty" days
return $calendar."</tr>\n</table>\n";
Have fun,
John