Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Re: [nir] list of subcategory

Quote Reply
Re: [nir] list of subcategory In reply to
Hi,

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!
Subject Author Views Date
Thread list of subcategory nir 4752 Jul 24, 2008, 4:40 AM
Thread Re: [nir] list of subcategory
Andy 4553 Jul 24, 2008, 4:50 AM
Thread Re: [Andy] list of subcategory
nir 4550 Jul 24, 2008, 4:54 AM
Thread Re: [nir] list of subcategory
Andy 4546 Jul 24, 2008, 5:54 AM
Thread Re: [Andy] list of subcategory
nir 4541 Jul 24, 2008, 6:40 AM
Thread Re: [nir] list of subcategory
Andy 4535 Jul 24, 2008, 6:41 AM
Post Re: [Andy] list of subcategory
nir 4529 Jul 24, 2008, 6:51 AM