Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Show Populair links last week

Quote Reply
Show Populair links last week

I show the populair links on my home page with a global.
How do I show the most populair links from every last week. (7days).

Can anybody help?
Thanks, Ron

This is the global:
sub {
# Displays the pop links on the home page.
my ($output,$sth,$link);
my $search_db = $DB->table('Links');
$search_db->select_options ('ORDER BY Hits DESC Limit 5');
$sth = $search_db->select ( { isNew => 'No', isValidated => 'Yes' });
while ($link = $sth->fetchrow_hashref) {
my $desc = $link->{'Description'};
unless (length $desc <= 30) {my $short = substr ($desc, 0, 30); $short =~ s/\s\S+?$//; $short .= " ...";
$link->{'Description'} = $short;}
$link->{'detailed_url'} = "$CFG->{build_detail_url}/$link->{'ID'}$CFG->{build_extension}";
$output .= Links::SiteHTML::display ('pop1', $link);
return $output;
Quote Reply
Re: [rsahertian] Show Populair links last week In reply to
If you have the ExtraStats plugin, I can write a global for you to do this.

Otherwise, I think Andy had a plugin which does this but I'm not sure how he collects the hit data.

Its difficult to do without a plugin as you don't have hit data by date - just the total hits. I think the only way would be to reset all the hits in your links table to zero every week - but I don't recommend doing this.
Quote Reply
Re: [rsahertian] Show Populair links last week In reply to
Laura is correct. I have a plugin called Top_Weekly_Link. However, it only allows for one link to be picked. The way it works out a popular link, is by grabbing the link with the most hits. There is an option in the plugin, which allows you to tell the script to reset the hits, or not. It all depends on how fair you want the rankings to be.



Andy (mod)
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!