Hi,
Try this:
my $sth = $DB->table('CatLinks')->select ( { LinkID => $_[0] }, ['CategoryID'] ) || die $GT::SQL::error;
my @cats;
while (my $hit = $sth->fetchrow_hashref) {
# print $hit->{LinkID} . "<br/>";
my $cat = $DB->table('Category')->select( { ID => $hit->{CategoryID} } )->fetchrow_hashref;
my $cat_url = $DB->table('Category')->as_url( $cat->{Full_Name} );
my $tmp;
$tmp->{Name} = $cat->{Name};
$tmp->{URL} = $CFG->{build_root_url} . "/" . $cat_url . "/" . $CFG->{build_index};
push @cats, $tmp;
}
return { cats_in => \@cats };
}
..and then this template code:
<ul>
<%loop cats_in%>
<li><a href="<%URL%>"><%Name%></a></li>
<%endloop%>
</ul>
Tested that on our dev install, and all seems to 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!
Try this:
Code:
sub { my $sth = $DB->table('CatLinks')->select ( { LinkID => $_[0] }, ['CategoryID'] ) || die $GT::SQL::error;
my @cats;
while (my $hit = $sth->fetchrow_hashref) {
# print $hit->{LinkID} . "<br/>";
my $cat = $DB->table('Category')->select( { ID => $hit->{CategoryID} } )->fetchrow_hashref;
my $cat_url = $DB->table('Category')->as_url( $cat->{Full_Name} );
my $tmp;
$tmp->{Name} = $cat->{Name};
$tmp->{URL} = $CFG->{build_root_url} . "/" . $cat_url . "/" . $CFG->{build_index};
push @cats, $tmp;
}
return { cats_in => \@cats };
}
..and then this template code:
Code:
<%get_cats_in($ID)%> <ul>
<%loop cats_in%>
<li><a href="<%URL%>"><%Name%></a></li>
<%endloop%>
</ul>
Tested that on our dev install, and all seems to 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!