Gossamer Forum
Home : Products : Gossamer Links : Discussions :

What's New Links in Sidebar

Quote Reply
What's New Links in Sidebar
I'd like to include the list of links to each day's "What's New" Links in the sidebar on each page of my links directory. Something like this:

- Sunday, June 17 2007 (2).
- Monday, June 11 2007 (1).
- Thursday, June 7 2007 (2).
- Wednesday, June 6 2007 (1).

While browsing the forums, I was able to find out how to list the latest X sites added to my directory, but that's not really what I want to do. I've tried to create global routine to make this work, but I haven't had any luck yet.

Any ideas?

Thanks in advance for your help!
Quote Reply
Re: [tester2] What's New Links in Sidebar In reply to

You could try this global (call it "get_new_links_list");

sub {



require GT::SQL::Condition;
my $cond = GT::SQL::Condition->new(
isNew => '=' => 'Yes',

my $link_db = $DB->table('Links');
$link_db->select_options("GROUP BY Add_Date", "ORDER BY Add_Date DESC");
my $sth = $link_db->select(Add_Date => 'COUNT(*)' => $cond);
my $total = 0;
$GRAND_TOTAL ||= $DB->table('CatLinks')->count - $DB->table('Links')->count({ isValidated => 'No' });;

my $results = '';
my @loop;
while (my ($date, $count) = $sth->fetchrow_array) {
my $long_date = GT::Date::date_transform($date, GT::Date::FORMAT_DATE, $CFG->{date_long_format});
$date =~ s,\s(.*),,;
$results .= qq|<li><a href="$CFG->{build_new_url}/$date$CFG->{build_extension}">$long_date</a> ($count)</li>|;
$total += $count;
push @loop, { date => $long_date, url => "$CFG->{build_new_url}/$date$CFG->{build_extension}", count => $count };

return { new_folder_loop => \@loop }


Then call with:

<%loop new_folder_loop%>
<a href="<%url%>"><%date%></a> (<%count%> links)<br />

I've tested it locally, and it seems to work ok :)


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!