Gossamer Forum
Quote Reply
weekly_top_link global
Hi
When using the plug iI am using Andy's plug in to create a top weekly link..
When adding the global as described I am getting a 500 error ..
Any ideas?

sub {
# define the used modules...
use Date::Calc qw( Week_Number );
# Get the all the values for current time
my ($Second, $Minute, $Hour, $Day, $Month, $Year, $WeekDay, $DayOfYear, $IsDST) = localtime(time);
# do stuff to the numbers, to get the appripriate month/year figures...
$Year = $Year % 100 + 2000;
$Month += 1;
# format date accordingly...
my $date = sprintf("%02d-%02d-%04d", $Day, $Month, $Year);
# slice up, so we have all figures seperatly...
my @sliced_date = split("-",$date);
# now lets get our week-number....
my $week = Week_Number($sliced_date[2],$sliced_date[1],$sliced_date[0]);
# do some calcs, cos we need stats from the months before..
if ($week < 52) { $week = $week - 1; }
elsif ($week == 52){ $week = 1; } # catch beginning of years...
# setup DB connections...
my $db_con = $DB->table("TopWeek");
my $sth2 = $db_con->select();
# get the URL, so we can redirect in a second...
my ($data_in,$field);
while (my $hit = $sth2->fetchrow_hashref) {
$field = "week_" . $week;
$data_in = $hit->{$field};
}
# now lets cut up, so we got hits etc...
my ($id,$hits) = split(" ",$data_in);
# get the link details we need...
my $db = $DB->table('Links');
my $link = $db->select ('*', { ID => $id })->fetchrow_hashref;
# return the HTML appropriatly...
return Links::SiteHTML::display ('weekly_link', $link);
}
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory

Last edited by:

katabd: Apr 18, 2004, 4:12 PM
Subject Author Views Date
Thread weekly_top_link global katabd 2726 Apr 18, 2004, 3:14 PM
Thread Re: [katabd] weekly_top_link global
Andy 2662 Apr 19, 2004, 1:41 AM
Thread Re: [Andy] weekly_top_link global
Gypsypup 2660 Apr 19, 2004, 1:54 AM
Thread Re: [Gypsypup] weekly_top_link global
Andy 2654 Apr 19, 2004, 1:55 AM
Post Re: [Andy] weekly_top_link global
Gypsypup 2636 Apr 19, 2004, 1:58 AM
Thread Re: [Andy] weekly_top_link global
katabd 2635 Apr 19, 2004, 10:02 AM
Post Re: [katabd] weekly_top_link global
Andy 2608 Apr 19, 2004, 10:04 AM