Gossamer Forum
Quote Reply
Re: [nir] Cat new link In reply to
Untested, but try this:

get_new_by_cat
Code:
sub {
my @cat_ids = split /,/, $_[0];

my $cond = new GT::SQL::Condition;
foreach (@cat_ids) { $cond->add('CatLinks.CategoryID','=',$_) }

$cond->bool('OR');

my $tbl = $DB->table('CatLinks','Links','CatLinks');
$tbl->select_options("ORDER BY Title");

my $sth = $tbl->select( ['Links.*'], $cond, { isNew => "Yes" } ) || die $GT::SQL::error;

my @loop;
while (my $hit = $sth->fetchrow_hashref) {
push @loop, $hit;
}

return { links_loop_by_cat => \@loop }


}

Call with:

Code:
<%get_new_by_cat('1,2,3,4')%>
<%if links_loop_by_cat.length%>
<%loop links_loop_by_cat%>
<%include link.html%>
<%endloop%>
<%endif%>

Replace:

'1,2,3,4'

..with the list of Categories you want to select from.

Hopefully that will work =)

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: Jul 29, 2008, 5:54 AM
Subject Author Views Date
Thread Cat new link nir 3980 Jul 29, 2008, 1:46 AM
Thread Re: [nir] Cat new link
Andy 3860 Jul 29, 2008, 1:59 AM
Thread Re: [Andy] Cat new link
nir 3839 Jul 29, 2008, 4:10 AM
Thread Re: [nir] Cat new link
Andy 3867 Jul 29, 2008, 5:55 AM
Post Re: [Andy] Cat new link
nir 3799 Jul 29, 2008, 6:11 AM