Today in years past:
# What's the full server path to your entrylist file?
$entrylist = "/path/to/entrylist.inc";
$i=0;
$total_results = "0";
# Let's start grabbing information from the file, one line at a time.
$line = file($entrylist);
# How many lines are there, total? We need to know this.
$total_length = count($line);
# We've pulled the contents of your entrylist into the variable $line, and
# counted how many lines your entrylist has. Now we've gotta go through,
# one line at a time, and check each line to see if it matches $variable.
do {
$this_entry = explode('|', $line[$i]);
$date_array = explode('/', $this_entry[3]);
if ( ($date_array[0] == $this_month) && ($date_array[1] == $this_day) && ($date_array[2] < $this_year))
{
$total_results++;
# in other words, if the entry matches your requirements
# give these easy-to-remember variables values:
$entry_link = $this_entry[0];
$author = $this_entry[1];
$category = $this_entry[2];
$subject = $this_entry[4];
$excerpt = $this_entry[5];
$month_integer = intval($date_array[0]);
# How do you want the months to be displayed? Edit the text between the
# quotes, but don't put in line breaks. Let the line wrap.
$month_names=array("01.", "02.", "03.", "04.", "05.", "06.", "07.", "08.", "09.", "10.", "11.", "12.");
$month = $month_names[($month_integer - 1)];
$day = intval($date_array[1]);
$year = $date_array[2];
# You've got a valid entry number now. The next line is what will be
# returned for every valid match. Change it to suit your needs; just
# don't forget to escape any embedded " marks with a \ , like this: \ "
# You'll want to use some combination of these variables:
# $month, $day, $year, $subject, $author, $category
echo "$year: $subject
$excerpt
";
}
# we've checked that entry, now let's go to the next line and check it
$i++;
}
# once you get to the end of the file, stop! let's not waste a busy CPU's time...
while ($i <= $total_length);
if ($total_results == "0") {
echo "No previous entries.";
}
?>