Does someone know the global that show the sub category of specific category (the same global that call category in the category page )?
Mar 2, 2008, 10:51 AM
Veteran / Moderator (17298 posts)
Mar 2, 2008, 10:51 AM
Post #2 of 9
Views: 926
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
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Mar 5, 2008, 3:02 AM
Veteran / Moderator (17298 posts)
Mar 5, 2008, 3:02 AM
Post #5 of 9
Views: 902
Hi,
Sorry, realised I didn't give you the code to loop through =)
Try:
<%loop subcat_loop%>
<a href="<%URL%>"><%Full_Name%></a> <br />
<%endloop%>
<%endif%>
Cheers
Andy (mod)
andy@ultranerds.co.uk
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
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
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Mar 5, 2008, 5:01 AM
Veteran / Moderator (17298 posts)
Mar 5, 2008, 5:01 AM
Post #7 of 9
Views: 894
Guessing it works ok now? :)
Cheers
Andy (mod)
andy@ultranerds.co.uk
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Cheers
Andy (mod)
andy@ultranerds.co.uk
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Jul 29, 2008, 8:58 PM
Novice (9 posts)
Jul 29, 2008, 8:58 PM
Post #8 of 9
Views: 830
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.
Jul 29, 2008, 11:25 PM
Veteran / Moderator (17298 posts)
Jul 29, 2008, 11:25 PM
Post #9 of 9
Views: 827
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
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
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
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates

