Hi,
Still not 100% sure what your asking for - but try this:
get_categorys_by_id
my $cat = shift;
my $all_ids = $DB->table('Category')->children($cat);
push @$all_ids, $cat;
my $tbl = $DB->table('Category');
$tbl->select_options ('ORDER Full_Name');
my $cond = GT::SQL::Condition->new('CategoryID', 'IN', $all_ids);
my $sth = $tbl->select ( $cond ) || die $GT::SQL::error;
my @cats;
while (my $hit = $sth->fetchrow_hashref) {
$hit->{URL} = $CFG->{build_root_url} . $tbl->as_url($hit->{Full_Name}) . '/' . $CFG->{build_index};
push @cats, $hit;
}
return { cat_loop => \@cats }
}
<ul>
<%loop cat_loop%>
<il><a href="<%Name%>"><%Name%></a></li>
<%endloop%>
</ul>
(change "1234" to the category ID you want to get)
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!
Still not 100% sure what your asking for - but try this:
get_categorys_by_id
Code:
sub { my $cat = shift;
my $all_ids = $DB->table('Category')->children($cat);
push @$all_ids, $cat;
my $tbl = $DB->table('Category');
$tbl->select_options ('ORDER Full_Name');
my $cond = GT::SQL::Condition->new('CategoryID', 'IN', $all_ids);
my $sth = $tbl->select ( $cond ) || die $GT::SQL::error;
my @cats;
while (my $hit = $sth->fetchrow_hashref) {
$hit->{URL} = $CFG->{build_root_url} . $tbl->as_url($hit->{Full_Name}) . '/' . $CFG->{build_index};
push @cats, $hit;
}
return { cat_loop => \@cats }
}
Code:
<%get_categorys_by_id(1234)%> <ul>
<%loop cat_loop%>
<il><a href="<%Name%>"><%Name%></a></li>
<%endloop%>
</ul>
(change "1234" to the category ID you want to get)
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!