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
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work! Want to give me something back for my help? Please see my
Amazon Wish List GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500) Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin |
Pre-Made Template Sets |
FREE GLinks Plugins! Compare our different Plugin packages *new* Free CSS Templates