/*
on the index page:
$today = getdate();
$this_month = $today['mon'];
$this_day = $today['mday'];
$this_year = $today['year'];
?>
This day last week
$thisdaylastx = "week";
include("/home/path/to/file/today2.php");
?>
This day last month
$thisdaylastx = "month";
include("/home/path/to/file/today2.php");
?>
*/
?>
# What's the full server path to your entrylist file?
$entrylist = "/home/spilgrim/public_html/rodent/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] == "01") {
$entrymonthname = "January";
} else if ($date_array[0] == "02") {
$entrymonthname = "February";
} else if ($date_array[0] == "03") {
$entrymonthname = "March";
} else if ($date_array[0] == "04") {
$entrymonthname = "April";
} else if ($date_array[0] == "05") {
$entrymonthname = "May";
} else if ($date_array[0] == "06") {
$entrymonthname = "June";
} else if ($date_array[0] == "07") {
$entrymonthname = "July";
} else if ($date_array[0] == "08") {
$entrymonthname = "August";
} else if ($date_array[0] == "09") {
$entrymonthname = "September";
} else if ($date_array[0] == "10") {
$entrymonthname = "October";
} else if ($date_array[0] == "11") {
$entrymonthname = "November";
} else if ($date_array[0] == "12") {
$entrymonthname = "December";
}
$stringdate = "".$date_array[1]." ".$entrymonthname." ".$date_array[2]." 00:00:00";
$tempstamp = strtotime($stringdate);
$entryTimeStamp = strtotime("+1 ".$thisdaylastx,$tempstamp);
/* if ( ($date_array[0] == $this_month) && ($date_array[1] == $this_day) && ($date_array[2] == $this_year)) */
$currentstrtime = "".$this_day." ".$today['month']." ".$this_year = $today['year']." 00:00:00";
$timestamplast = strtotime($currentstrtime);
if ($entryTimeStamp == $timestamplast)
{
$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("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
$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 "$month $day, $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.";
}
?>