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

Count of new links in category

Quote Reply
Count of new links in category
Hi all,

I have this nice global to show all the top level categories on any page.
The challenge is to get the actual count of New links in the categories like:

Applications (20 new links)




sub {
# returns all categories
my $category = $DB->table('Category');
$category->select_options('ORDER BY Name ASC');
my $sth = $category->select( ['Name','Full_Name'] );
my @cats;
while (my $cat = $sth->fetchrow_hashref) {
$cat->{URL} = "$CFG->{build_root_url}/" . $category->as_url($cat->{Full_Name}) . "/";
push @cats, $cat;
}
return { allcats => \@cats };
}

<%All_Cats%>
<%loop allcats%>
<a href="<%URL%>"><%Name%></a> (<%num_links%> new links)
<%endloop%>

~ ERASER


Free JavaScripts @ Insight Eye

Last edited by:

Eraser: Nov 14, 2006, 3:45 AM