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

Products: Gossamer Links: Development, Plugins and Globals: show newest links per category on the right categorypage: Edit Log

Here is the list of edits for this post
show newest links per category on the right categorypage

Laura (afinlr) made this global to show the newest links per category on the proper categorypage...
(Place it on the category-template)

thanks a lot Laura!!! It's very usefull..........all the credits for you......

sub {
my $tags = shift;
my ($all_ids,$output);
my $cat_id = $tags->{'ID'};
$all_ids = $DB->table('Category')->children($cat_id);
push @$all_ids, $cat_id;
my $link_db = $DB->table('Links','CatLinks','Category');
$link_db->select_options ("ORDER BY Add_Date DESC LIMIT 5");
my $condition = GT::SQL::Condition->new( 'isValidated','=','Yes','isNew','=','Yes','CategoryID', 'IN', $all_ids);
my $sth = $link_db->select($condition);
$output = qq~<b>The newest Links in this category and the following subcategories:</b>~;
while (my $link = $sth->fetchrow_hashref) {
# Set the category url
my $url = $DB->table('Category')->as_url($link->{'Full_Name'});
# Set the detailed_url
my $detailed_url = "$CFG->{build_detail_url}/$link->{'LinkID'}$CFG->{build_extension}";
$output .= qq~<li><a href="$CFG->{build_root_url}/$url/">$link->{'Name'}</a> | $link->{'Add_Date'}<br><a href="$detailed_url">$link->{'Title'}</a></li>~;
return $output;

Last edited by:

rsahertian: Aug 18, 2003, 1:04 PM

Edit Log: