Should be pretty simple:
get_cats_for_links
Code:
sub {
my $link_ids;
foreach (split /,/, $_[0]) {
push @$link_ids, $_;
}
my $sth = $DB->table('CatLinks')->select( ['DISTINCT(CategoryID)'], GT::SQL::Condition->new('LinkID','IN',$link_ids) ) || die $GT::SQL::error;
my @categories;
while (my $cat_id = $sth->fetchrow) {
my $cat = $DB->table('Category')->get( { ID => $cat_ids } );
$cat->{URL} = $CFG->{build_root_url} . "/" . $DB->table('Category')->as_url( $cat->{Full_Name} ) . "/" . $CFG->{build_index};
push @categories, $cat;
}
return { categorys_links_are_in_loop => \@categories };
}
..then call with:
Code:
<%get_cats_for_links('123,434,345,765')%>
<%loop categorys_links_are_in_loop%>
<%include subcategory.html%>
<%endloop%>
Untested, but should 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