This was originally going to be a journal. I have several friends who are journal-keepers, and it's always struck me as a generally cool and useful thing to do, but somehow I never get around to actually keeping a journal, though I've started several times.
I suspect that the main reason I never manage to keep a journal is that a journal is a place where one writes down what is occurring in one's life, and, well, I don't have one. A life, that is. Well, sometimes I do, but then I'm generally too busy having it to write about it.
The URL
http://www.PigsAndFishes.org/natter/latest.html will always take you to the latest entry.
Table of Natter:
\n";
$monthnames = array('', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
$checkyear = 1995;
$closeyear = '';
$yearlinks = '';
$lastmm = 9;
foreach ($natterlist as &$natter_file) {
// Build the date from the filename:
$day = substr($natter_file, 6, 2);
$day = ereg_replace("^0", "", $day);
$mm = substr($natter_file, 4, 2);
$mm = ereg_replace("^0", "", $mm);
$year = substr($natter_file, 0, 4);
$month = $monthnames[$mm];
// echo "$day $month $year
";
// Get the description text out of the file:
$natter_file_title = $natter_file;
$fh = fopen(getenv('DOCUMENT_ROOT') . "/natter/$natter_file", "r");
while(!feof($fh)) {
$one_line = fgets($fh, 1028);
if (ereg("title", $one_line)) {
$natter_file_title = trim($one_line);
$natter_file_title = substr($natter_file_title, 1); // Knock off that pesky $
$natter_file_title = ereg_replace('^title[[:space:]]*=[[:space:]]*"', '', $natter_file_title);
$natter_file_title = ereg_replace('";$', '', $natter_file_title);
break;
}
}
fclose($fh);
// Build the HTML text:
if ($mm > $lastmm) { // If it's been more than a month since the last entry
$returntext .= "\t\t\t
\n";
if ($mm - $lastmm > 1) { // Just skipped one month?
$monthspan = '';
if ($mm - $lastmm == 2) {
$monthspan = $monthnames[$mm - 1];
} else { // Or skipped several months?
$monthspan = $monthnames[$lastmm + 1] . '-' . $monthnames[$mm - 1];
}
$returntext .= "\t\t\t$monthspan: hiatus
\n\t\t\t
\n";
}
}
if (($mm < $lastmm) && ($lastmm - $mm < 11)) { // If we skipped a month or more crossing a year boundary
$returntext .= "\t\t\t
\n";
// Need to do this in two chunks
// First, the end of the old year year:
// I only need to do something if the last entry was earlier than December
if ($lastmm == 11) { // If last entry was in November, the December was skipped
$returntext .= "\t\t\t$monthnames[12]: hiatus
\n\t\t\t
\n";
} elseif ($lastmm < 11) {
$returntext .= "\t\t\t" . $monthnames[$lastmm + 1] . '-' . $monthnames[12] . ": hiatus
\n\t\t\t
\n";
}
}
// Is it a new year? If so, say so, and stick a table row in:
if ($checkyear != $year) {
$returntext .= $closeyear . "\t\n\t\t\n\t\t\t\n\t\t | \n\t\t\n";
$closeyear = "\t\t | \n\t
\n";
$checkyear++;
$yearlinks .= "$year |\n";
}
if (($mm < $lastmm) && ($lastmm - $mm < 11)) { // If we skipped a month or more crossing a year boundary
// Second chunk of year-crossing hiatus:
// I only need to do something if this entry is later than January
if ($mm == 2) { // If this entry is in February, January was skipped
$returntext .= "\t\t\t$monthnames[1]: hiatus
\n\t\t\t
\n";
} elseif ($mm > 2) { // If this entry is after February
$returntext .= "\t\t\t" . $monthnames[1] . '-' . $monthnames[$mm - 1] . ": hiatus
\n\t\t\t
\n";
}
}
$returntext .= "\t\t\t$month $day: $natter_file_title
\n";
$lastmm = $mm;
};
$returntext .= "\t\t\n\t\n\n";
$yearlinks = ereg_replace("[[:space:]]*\|[[:space:]]*$", "\n", $yearlinks); // Trim trailing |\n
echo "\n$yearlinks
\n" . $returntext;
?>