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
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!