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!