このページは過去に掲載していたものをそのまま使用しています。
べつにどうというものでもないのですが、ちょっとした苦労で定型的な作業から 開放される例です。
<?php
$this_year = date("Y");
$this_month = date("M");
while ($this_year >= 1999) {
echo "<H2>".$this_year."</H2> [";
for ($i=1; $i <= 12; $i++) {
/* prepare essential variables */
$month = date("M",mktime(0,0,0,$i,1,2000));
$diary_file = $month.$this_year.".html";
if (file_exists($diary_file)) {
echo "<A href=".$diary_file.">$month</A>";
} else {
echo $month;
}
if ($i != 12) {
echo " | ";
}
}
echo " ]\n";
$this_year--;
}
?>