Gossamer Forum
Home : Products : Links 2.0 : Discussions :

SubCategory Display Issue

Quote Reply
SubCategory Display Issue
I'm having a problem displaying the subcategory in my custom drop down navigation correctly.

What I'd like to show is just the subcategory names for the CURRENTLY selected category, not the whole root directory information, and all subcategories available in the database ..

This is what I get:

Books and Magazines:Amazon
Books and Magazines:Barnes and Noble
Computers: Buy.com
Computers: Outpost.com


This is what I want: (Remember only for the current category not all categories) So if I'm in Books and Magazines category below would be what I'd like to dislay for the subcategories.

Amazon
Barnes and Noble


Code:

# This one is automatic - requires javascript code in header of pages
###################################
sub hopto_subcategory{
###################################
$output = qq~
<form name="subcatform">
<select name="site" size=1 onChange="javascript:formHandler()">
<option value="">Browse Deals
<option value="">------------------------------- ~;
CATEGORY: foreach $cat (sort keys %category) {
# next CATEGORY if ($cat =~ /^\s*$/); # Shows Everything
# next unless ($cat =~ m,^([^/]*)$,); # Shows ONLY Main Categories
next if ($cat =~ m,^([^/]*)$,); # Shows ONLY Sub-Categories
$title = &build_unlinked_title ($cat);
@categorylist = split (/\//, $cat);
$output .= qq~<option value="$build_root_url/$cat/">$title ~;
}
$output .= qq~</select></form>~;
return $output;
}


Quote Reply
Re: SubCategory Display Issue In reply to
I figured it out tonight - Hope this comes in handy for others ..

# This one is automatic - requires javascript code in header of pages
###################################
sub hopto_subcategory{
###################################
$output = qq~
<form name="subcatform">
<select name="site" size=1 onChange="javascript:formHandler()">
<option value="">Browse Deals
<option value="">------------------------------- ~;
CATEGORY: foreach $subcat (sort keys %category) {
# next CATEGORY if ($cat =~ /^\s*$/); # Shows Everything
# next unless ($cat =~ m,^([^/]*)$,); # Shows ONLY Main Categories
next if ($subcat =~ m,^([^/]*)$,); # Shows ONLY Sub-Categories
$title = &build_unlinked_title ($subcat);
@subcategorylist = split (/\//, $subcat);
$p = rindex($title,":")+1;
$zcat = substr($title, $p);
$output .= qq~<option value="$build_root_url/$subcat/">$zcat ~;
}
$output .= qq~</select></form>~;
return $output;
}


It displays all the subcategories for the system still. I'm still in need of a mod for this that will just display the subcategories in the current category ..