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

Global to display newest links with category first on homepage.

Quote Reply
Global to display newest links with category first on homepage.
Hi All,

I am using this nice global (here below) from Laura to display the newest links. It shows the Title en (short) Description.

Now I want a global to display the newest Category and Title. (in that order)

And only the category must be hyperlinked, if possible

Thanks,
Ron


#####################################
sub {
# Displays the newest links on the home page.
my ($output,$sth,$link);
my $search_db = $DB->table('Links','CatLinks','Category');
$search_db->select_options ('ORDER BY Add_Date DESC Limit 5');
$sth = $search_db->select ( { isNew => 'Yes', 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 ('new_link', $link);
}
return $output;
}
#####################################

Last edited by:

rsahertian: Feb 13, 2004, 10:13 AM