Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

What's Cool in last 30 days?

Quote Reply
What's Cool in last 30 days?
I was wondering if anyone knows a modification I could make so that only links added in the last 30 days show up in the What's Cool page. I'm running a news service so links before that time aren't really relevent.

Thanks,

Joey

Quote Reply
Re: What's Cool in last 30 days? In reply to
Joey,

What's wrong with using the 'New' section?

To do it with the cool links you'd need a TABLE of daily hits for every link, probably with the following fields; "Link ID", "Date", "Total Hits". You'd need to modify 'jump.cgi' for when someone clicks on a link - it'll need to check if there is an entry for 'today' for the Link ID, if not create one, if there is add '1' to the total.

Then when you do a site build you'd need a routine that would go through the 'Daily Hits' table and add up the last 30 days of hits for EVERY link, then sort out x no. of cool links for display.

Well, that's the logic (AFAICS), but I haven't got the experience to say how easy a mod it would be - sorry :)


All the best
Shaun

Quote Reply
Re: What's Cool in last 30 days? In reply to
my $sth = $db->prepare ("SELECT * FROM Links WHERE UNIX_TIMESTAMP(NOW) - UNIX_TIMESTAMP(Add_Date) <= 30 * 86400");
$sth->execute() or die $DBI::errstr;
while (my $rec = $sth->fetchrow_hashref) {
# blah
}

thats how you get the links..

Jerry Su
Quote Reply
Re: What's Cool in last 30 days? In reply to
Thanks jerrysu,

I'm assuming this goes in the nph-build.cgi, I've tried it in the logical places but just get software error. Any hints as to where to best put this code?

Joey