Dec 18, 1998, 7:32 PM
Veteran / Moderator (8669 posts)
Dec 18, 1998, 7:32 PM
Post #3 of 8
Views: 3210
Here's what I did.
In html.pl, I added the following lines at the beginning of sub html_home:
---------------------------
@DaysOfMonths = (31,28,31,30,31,30,31,31,30,31,30,31);
@MonthNames = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec' );
@time = localtime(time);
$TodayMonth = $time[4];
$TodayDay = $time[3];
$TodayYear = $time[5] + 1900;
$n = 7; #the number of days you want to include in your "What's New"
$LastDay = $TodayDay - $n;
if ( $LastDay > 0 ) { #day n was this month
$LastMonth = $TodayMonth;
$LastYear = $TodayYear;
}
else { #day n was last month
if ( $TodayMonth > 0 ) { #for all months except January
$LastMonth = $TodayMonth - 1;
$LastDay = $DaysOfMonths[$LastMonth] + $LastDay;
$LastYear = $TodayYear;
}
else { #for the month of January
$LastMonth = 11;
$LastDay = 31 + $LastDay;
$LastYear = $TodayYear - 1;
}
}
$Last = "$LastDay-$MonthNames[$LastMonth]-$LastYear"; # assuming the default date format
-------------------
Then, wherever you want your "What's New," (in the same subroutine!) add a link like:
------------------
<a href="$db_script_link_url&date=%3E$Last&view_records=1"><$font><B>What's New</B></font></a>
------------------------
That, of course, assumes that your date field is called "date." Remember that case counts, so "date" is not the same as "Date" or "DATE." Also, I tried using date-gt=$Last, but it didn't work.
BTW, the above is not adjusted for leap years. I decided to wait until it was closer to the time to deal with it.
I have no idea about a "what's cool" feature.
Hope this helps.
------------------
JPD
[This message has been edited by JPDeni (edited December 18, 1998).]