Gossamer Forum
Quote Reply
Re: [nir] New link Loop In reply to
Hi,

Something like this should work:
Code:
sub {
my $cat = $_[0];
my ($output,$sth,$link);
my $all_ids = $DB->table('Category')->children($cat);
push @$all_ids, $cat;
my $search_db = $DB->table('Links','CatLinks','Category');
$search_db->select_options ('ORDER BY Add_Date DESC Limit 10');
$sth = $search_db->select ( ['Links.*'], GT::SQL::Condition->new(['CategoryID', 'IN', $all_ids], ['isValidated', '=', 'Yes', 'isNew', '=', 'Yes']) );
my $seen;
my $output;
my @loop;
while ($link = $sth->fetchrow_hashref) {
if ($seen->{$link->{ID}}) { next }
$link->{category_url} = $CFG->{build_root_url}."/".$link->{'Full_Name'}."/";
$link->{detailed_url} = "$CFG->{build_detail_url}/$link->{'ID'}$CFG->{build_extension}";
#$output .= Links::SiteHTML::display('sortlink', $link);
$seen->{$link->{ID}} = 1;
push @loop, $link;
}

return { new_loop => \@loop, rows => $sth->rows };
}

Call with:

Code:
<%global_name%>
<%loop new_loop%>
<%inlcude sortlink.html%>
<%endloop%>

Cheers

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!

Last edited by:

Andy: Dec 13, 2007, 4:03 AM
Subject Author Views Date
Thread New link Loop nir 10616 Dec 12, 2007, 7:19 AM
Thread Re: [nir] New link Loop
Andy 10126 Dec 13, 2007, 12:21 AM
Thread Re: [Andy] New link Loop
Wychwood 10053 Dec 13, 2007, 2:35 AM
Post Re: [Wychwood] New link Loop
Andy 10100 Dec 13, 2007, 2:49 AM
Thread Re: [Andy] New link Loop
nir 10087 Dec 13, 2007, 4:00 AM
Thread Re: [nir] New link Loop
Andy 10098 Dec 13, 2007, 4:05 AM
Thread Re: [Andy] New link Loop
nir 10033 Dec 20, 2007, 4:30 AM
Thread Re: [nir] New link Loop
Andy 10066 Dec 21, 2007, 2:30 AM
Thread Re: [Andy] New link Loop
nir 10009 Dec 23, 2007, 12:42 AM
Thread Re: [nir] New link Loop
Andy 10053 Dec 23, 2007, 12:48 AM
Thread Re: [Andy] New link Loop
nir 10034 Dec 23, 2007, 1:05 AM
Thread Re: [nir] New link Loop
Andy 10054 Dec 23, 2007, 2:53 AM
Thread Re: [Andy] New link Loop
nir 10013 Dec 23, 2007, 2:57 AM
Thread Re: [nir] New link Loop
Andy 9994 Dec 23, 2007, 3:04 AM
Thread Re: [Andy] New link Loop
nir 10011 Dec 23, 2007, 3:33 AM
Thread Re: [nir] New link Loop
Andy 10001 Dec 23, 2007, 3:45 AM
Thread Re: [Andy] New link Loop
nir 9988 Dec 23, 2007, 5:45 AM
Post Re: [nir] New link Loop
Andy 9949 Dec 23, 2007, 6:32 AM