Ah ok - thats pretty simple then. The other global won't work, but its easy to change it specifically for this task:
get_parent_categories
my $cat_id = $_[0];
my $father_id = $DB->table("Category")->select( ['FatherID'], { ID => $cat_id } )->fetchrow || '';
my $sth = $DB->table("Category")->select( { FatherID => $father_id } ) || die $GT::SQL::error;
my @cats;
while (my $cat = $sth->fetchrow_hashref) {
next if $cat->{ID} == $cat_id;
$cat->{URL} = $CFG->{build_root_url} . "/" . $DB->table('Category')->as_url( $cat->{Full_Name} ) . "/" . $CFG->{build_index};
push @cats, $cat;
}
return { parent_cat_loop => \@cats };
}
Then call with:
<%loop parent_cat_loop %>
....
<%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!
get_parent_categories
Code:
sub { my $cat_id = $_[0];
my $father_id = $DB->table("Category")->select( ['FatherID'], { ID => $cat_id } )->fetchrow || '';
my $sth = $DB->table("Category")->select( { FatherID => $father_id } ) || die $GT::SQL::error;
my @cats;
while (my $cat = $sth->fetchrow_hashref) {
next if $cat->{ID} == $cat_id;
$cat->{URL} = $CFG->{build_root_url} . "/" . $DB->table('Category')->as_url( $cat->{Full_Name} ) . "/" . $CFG->{build_index};
push @cats, $cat;
}
return { parent_cat_loop => \@cats };
}
Then call with:
Code:
<%get_parent_categories($ID)%> <%loop parent_cat_loop %>
....
<%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!