Gossamer Forum
Home : Products : Gossamer Links : Discussions :

show sub category of specific category

Quote Reply
show sub category of specific category
Does someone know the global that show the sub category of specific category (the same global that call category in the category page )?
Quote Reply
Re: [nir] show sub category of specific category In reply to
nir wrote:
Does someone know the global that show the sub category of specific category (the same global that call category in the category page )?

You mean something like this?:

<%get_sub_cats($category_id)%> (will only work on category.html)

Code:
sub {

my $cat_id = $_[0];

my $tbl = $DB->table( 'Category');
$tbl->select_options('ORDER BY Name');
my $sth = $tbl->select( { FatherID => $cat_id } ) || die $GT::SQL::error;

my @loop;
while (my $hit = $sth->fetchrow_hashref) {
$cat->{URL} = $CFG->{build_root_url} . "/" . $DB->table('Category')->as_url( $cat->{Full_Name} ) . "/" . $CFG->{build_index};
push @loop, $hit;
}

return { subcat_loop => \@loop };

}

Hope that helps.

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!

Last edited by:

Andy: Mar 5, 2008, 3:03 AM
Quote Reply
Re: [Andy] show sub category of specific category In reply to
Hi Andy
its not work, I don’t get any result.
Quote Reply
Re: [Andy] show sub category of specific category In reply to
it still doesn't work.. Wink
Quote Reply
Re: [nir] show sub category of specific category In reply to
Hi,

Sorry, realised I didn't give you the code to loop through =)

Try:

Code:
<%if subcat_loop.length%>
<%loop subcat_loop%>
<a href="<%URL%>"><%Full_Name%></a> <br />
<%endloop%>
<%endif%>

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!

Last edited by:

Andy: Mar 5, 2008, 3:03 AM
Quote Reply
Re: [Andy] show sub category of specific category In reply to
ThnaksCool
Quote Reply
Re: [nir] show sub category of specific category In reply to
Guessing it works ok now? :)

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!
Quote Reply
Re: [Andy] show sub category of specific category In reply to
Andy wrote:
nir wrote:
Does someone know the global that show the sub category of specific category (the same global that call category in the category page )?


You mean something like this?:

<%get_sub_cats($category_id)%> (will only work on category.html)

Hi Andy,

how can I do that for the home.html? I would like to display a subcategory on the index page.
Quote Reply
Re: [Steelhammer] show sub category of specific category In reply to
Hi,

You would just call it with the category number hard-coded, instead of $category_id. For example

<%get_sub_cats(1234)%>

(where 1234 is the category you wanna show)

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!