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

Trying to list the last 50 new links.... But not necessarily new....

Quote Reply
Trying to list the last 50 new links.... But not necessarily new....
I,m trying to build a global that will pull back X number of links sorted by the most recently added. I will use this global on the new.html template in place of the built in process. They do not necessarily have to be "isNew", I just want to have the last X number that I have added. Any help would be greatly appreciated.

Thanks,
George
Quote Reply
Re: [macbethgr] Trying to list the last 50 new links.... But not necessarily new.... In reply to
Hi,

Something like this out of my ULTRAGlobals plugin should do the trick:

Latest_New_Links
Code:
sub {

my $limit = $_[0] || 10;
my $table = $DB->table('Links');
$table->select_options ("ORDER BY ID DESC LIMIT $limit");

my $sth = $table->select( { isValidated => 'Yes', isNew => 'Yes' }) || die $GT::SQL::error;
my @output;
while (my $link = $sth->fetchrow_hashref) {
$link = Links::SiteHTML::tags('link', $link);
push @output, $link;
}
return { Latest_Links_Loop => \@output };

}

Just change this line so it doesn't require it to be isNew:

Code:
my $sth = $table->select( { isValidated => 'Yes' }) || die $GT::SQL::error;

Angelic

Andy (mod)
andy@ultranerds.co.uk
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!
Quote Reply
Re: [Andy] Trying to list the last 50 new links.... But not necessarily new.... In reply to
Thanks.... works like a charm!