I've been looking for a way to display just subcategories alone. For instance, instead of "Arts: Music: Reggae," I wanted to just have "Music" or "Reggae" alone. I found a mod called "Display related subcats without showing top cats" (at http://gossamer-threads.com/...uest=10364198#157059) and fiddled with it. Low and behold, something I did worked.
It's really easy and you can call it on your template pages.
1. In nph-build.cgi, under sub build_category_pages, find:
$title_linked = &build_linked_title ($cat);
$title = &build_unlinked_title ($cat);
$total = ($#{$links{$cat}} + 1) / ($#db_cols + 1);
$category_name = $cat;
$category_name_escaped = &urlencode ($cat);
$category_clean = &build_clean ($cat);
Change to:
$last_title = &build_last_title ($cat);
$title_linked = &build_linked_title ($cat);
$title = &build_unlinked_title ($cat);
$total = ($#{$links{$cat}} + 1) / ($#db_cols + 1);
$category_name = $cat;
$category_name_escaped = &urlencode ($cat);
$category_clean = &build_clean ($cat);
2. Then, below sub build_linked_title, add this new sub (from the thread above):
##############Begin Last Title Mod #######
sub build_last_title {
# --------------------------------------------------------
# Returns a string of the current category broken up
# by section, with the last part to the respective section.
# copy of build_linked_title
my $input = shift;
my (@dirs, $dir, $output, $path, $last, $lasttitle);
@dirs = split (/\//, $input);
$last = &build_clean(pop @dirs);
$output = qq||;
foreach $dir (@dirs) {
$path .= "/$dir";
$dir = &build_clean ($dir);
$output .= qq||;
}
$output .= " $last";
return $output;
}
###############End Last Title Mod #######
3. Whichever template you want only subcategories alone on, you have to add it to the globals in site_html_templates. For instance, I wanted to use it on my category.html template. So in site_html_templates, under sub site_html_category, I added:
last_title => $last_title,
above
category_name => $category_name,
4. Now you can call it with the tag <%last_title%> on your template.
Pretty easy, huh? Thanks, nowidid and Bobb Menk, who came up with the original mod.
Kathy
It's really easy and you can call it on your template pages.
1. In nph-build.cgi, under sub build_category_pages, find:
$title_linked = &build_linked_title ($cat);
$title = &build_unlinked_title ($cat);
$total = ($#{$links{$cat}} + 1) / ($#db_cols + 1);
$category_name = $cat;
$category_name_escaped = &urlencode ($cat);
$category_clean = &build_clean ($cat);
Change to:
$last_title = &build_last_title ($cat);
$title_linked = &build_linked_title ($cat);
$title = &build_unlinked_title ($cat);
$total = ($#{$links{$cat}} + 1) / ($#db_cols + 1);
$category_name = $cat;
$category_name_escaped = &urlencode ($cat);
$category_clean = &build_clean ($cat);
2. Then, below sub build_linked_title, add this new sub (from the thread above):
##############Begin Last Title Mod #######
sub build_last_title {
# --------------------------------------------------------
# Returns a string of the current category broken up
# by section, with the last part to the respective section.
# copy of build_linked_title
my $input = shift;
my (@dirs, $dir, $output, $path, $last, $lasttitle);
@dirs = split (/\//, $input);
$last = &build_clean(pop @dirs);
$output = qq||;
foreach $dir (@dirs) {
$path .= "/$dir";
$dir = &build_clean ($dir);
$output .= qq||;
}
$output .= " $last";
return $output;
}
###############End Last Title Mod #######
3. Whichever template you want only subcategories alone on, you have to add it to the globals in site_html_templates. For instance, I wanted to use it on my category.html template. So in site_html_templates, under sub site_html_category, I added:
last_title => $last_title,
above
category_name => $category_name,
4. Now you can call it with the tag <%last_title%> on your template.
Pretty easy, huh? Thanks, nowidid and Bobb Menk, who came up with the original mod.
Kathy