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

Globals:: Last 5 and Last x by cateory

Quote Reply
Globals:: Last 5 and Last x by cateory
Hi All-

I have two globals that are for posting the last 5 links and also the last # by category.

I have recently changed my format to allow for non-website listings to appear on the detail page. Problem is now the globals only want to jump to a link and they can't differentiate between the links and non-links listings. Here are the globals, the last 5 I believe Andy gave to me. How can I make them work for both?

Last 5

sub {
my $LinkOwner = shift;
my $sth;
my $link_db = $DB->table ('Links');
$link_db->select_options ('ORDER BY ID DESC', 'LIMIT 5');
if ($LinkOwner) { $sth = $link_db->select( { isValidated => "Yes", LinkOwner => $LinkOwner } );
} else {
$sth = $link_db->select( { isValidated => "Yes" } );
}
my $output = '';
while (my $link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display('link', $link);
}
return $output;
}



last by category

sub {
# Displays the newest links on the home page.
my ($output,$sth,$link);
my $cat = shift;
my $search_db = $DB->table('CatLinks', 'Links');
$search_db->select_options ('ORDER BY Add_Date DESC Limit 3');
$sth = $search_db->select ( { isValidated => 'Yes', CategoryID => $cat });
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('newestlink', $link);
}
return $output;
}



Could I also get one for Cool links?

Thanks!!

Last edited by:

SSmeredith: Oct 8, 2004, 8:07 AM
Subject Author Views Date
Thread Globals:: Last 5 and Last x by cateory SSmeredith 3983 Oct 8, 2004, 8:03 AM
Thread Re: [SSmeredith] Globals:: Last 5 and Last x by cateory
SSmeredith 3817 Oct 13, 2004, 8:46 PM
Thread Re: [SSmeredith] Globals:: Last 5 and Last x by cateory
afinlr 3806 Oct 14, 2004, 11:10 AM
Thread Re: [afinlr] Globals:: Last 5 and Last x by cateory
SSmeredith 3796 Oct 14, 2004, 12:26 PM
Thread Re: [SSmeredith] Globals:: Last 5 and Last x by cateory
afinlr 3798 Oct 14, 2004, 1:59 PM
Thread Re: [afinlr] Globals:: Last 5 and Last x by cateory
SSmeredith 3808 Oct 14, 2004, 4:07 PM
Thread Re: [SSmeredith] Globals:: Last 5 and Last x by cateory
afinlr 3778 Oct 14, 2004, 4:20 PM
Thread Re: [afinlr] Globals:: Last 5 and Last x by cateory
SSmeredith 3799 Oct 14, 2004, 6:42 PM
Post Re: [SSmeredith] Globals:: Last 5 and Last x by cateory
afinlr 3773 Oct 15, 2004, 9:23 AM
Thread Re: [afinlr] Globals:: Last 5 and Last x by cateory
MJ_ 3773 Oct 15, 2004, 12:15 PM
Post Re: [Oyo] Globals:: Last 5 and Last x by cateory
afinlr 3780 Oct 15, 2004, 12:25 PM