I'd appreciate any help anyone can give me. I'm trying to make my category pages list subcategories single spaced while leaving the main category listing as is, i.e. recreate what is done here: http://vlib.anthrotech.com/
I've gone through every post and still am having problems. Check out my site_html_template.pl code.
(By the way, I'm using the yahoo subcategories mod v2.0 and I've altered my nph-build.cgi per http://www.gossamer-threads.com/scripts/forum/resources/Forum3/HTML/004980.html.)
# --------------------------------------------------------
# This routine determines how the list of categories will look.
# We now use a table to split the category name up into two columns.
# For each category you can use the following variables:
#
# $url : The URL to go to that category
# $category_name : The category name with _ and / removed.
# $category_descriptions{$subcat}: The category description (if any).
# $numlinks : The number of links inside that category (and subcategories).
# $mod : The newest link inside of that category.
#
my (@subcat) = @_;
my ($url, $numlinks, $mod, $subcat, $category_name, $description, $output, $i);
my ($half) = int (($#subcat+2) / 2);
# Print Header.
$output = qq|<div class="margin"><table width="100%" border="0" cellspacing="5" cellpadding="0"><tr><td class="catlist" valign="top">\n|;
foreach $subcat (sort @subcat) {
($description) = @{$category{$subcat}}[2];
# First let's get the name, number of links, and last modified date...
$url = "$build_root_url/" . &urlencode($subcat) . "/";
if ($subcat =~ m,.*/([^/]+)$,) { $category_name = &build_clean($1); } else { $category_name = &build_clean($subcat); }
$numlinks = $stats{"$subcat"}[0];
$mod = $stats{"$subcat"}[1];
# We check to see if we are half way through, if so we stop this table cell
# and begin a new one (this lets us have category names in two columns).
if ($i == $half) {
$output .= qq|</td><td class="catlist" valign="top">\n|;
}
$i++;
# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<dl><dt><a class="link" href="$url">$category_name</a> <small class="numlinks">($numlinks)</small> |;
$output .= qq|<font color="#FF0000"><small><sup class="new">new</sup></small></font>| if (&days_old($mod) < $db_new_cutoff);
$output .= qq|<BR></dt>|;
if ($description =~ m,^\(([^\)]+)\)(\d)$, && $#{$subcategories{$subcat}} >= 0) {
($description, $style) = ($1, $2);
$s = 0;
@subcatsub = split (/\|/, $description);
foreach $category_name (@subcatsub) {
foreach (sort @{$subcategories{$subcat}}) {
($description eq "ALL" && $#subcatsub == 0) ?
($_ =~ m,.*/([^/]+)$, and $category_name = &build_clean($1)) :
($_ eq "$subcat/$category_name" or next);
if ($style eq "1") {
$length += length($category_name);
($length > $subcat_length) and last;
}
if ($s > 0) {
$output .= qq~<font size="1">, </font>~ and $length += 2 if ($style eq "1");
$output .= qq~<font size="1"></font><BR>~ if ($style eq "2");
}
$url = "$build_root_url/" . &urlencode($_) . "/";
$output .= qq~<font size="1"> </font>~ if ($style eq "2");
$output .= qq~<font size="1"><A href="$url">$category_name</A></font>~;
$s++;
last if ($description ne "ALL" && $#subcatsub > 0);
}
}
undef $length;
if ($s < $#{$subcategories{$subcat}}) {
$output .= qq~<font size="1">...</font>~ if ($style eq "1");
}
}
$output .= qq|</dl>|;
}
# Don't forget to end the unordered list..
$output .= "</td></tr></table></div>\n";
return $output;
}
1;
sub site_html_print_subcat {
# --------------------------------------------------------
# This routine determines how the list of categories will look.
# We now use a table to split the category name up into two columns.
# For each category you can use the following variables:
#
# $url : The URL to go to that category
# $category_name : The category name with _ and / removed.
# $category_descriptions{$subcat}: The category description (if any).
# $numlinks : The number of links inside that category (and subcategories).
# $mod : The newest link inside of that category.
#
my (@subcat) = @_;
my ($url, $numlinks, $mod, $subcat, $category_name, $description, $output, $i);
my ($half) = int (($#subcat+2) / 2);
# Print Header.
$output = qq|<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top">\n|;
foreach $subcat (sort @subcat) {
($description) = @{$category{$subcat}}[2];
# First let's get the name, number of links, and last modified date...
$url = "$build_root_url/" . &urlencode($subcat) . "/";
if ($subcat =~ m,.*/([^/]+)$,) { $category_name = &build_clean($1); } else { $category_name = &build_clean($subcat); }
$numlinks = $stats{"$subcat"}[0];
$mod = $stats{"$subcat"}[1];
# We check to see if we are half way through, if so we stop this table cell
# and begin a new one (this lets us have category names in two columns).
if ($i == $half) {
$output .= qq|</td><td valign="top">\n|;
}
$i++;
# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<strong><href="$url">$category_name</a></strong>|;
$output .= qq|<small><sup "new">new</sup></small>| if (&days_old($mod) < $db_new_cutoff);
$output .= qq|<span "descript">$description </span>| if (!($description =~ /^[\s\n]*$/));
}
# Don't forget to end the unordered list..
$output .= "</table></div>\n";
return $output;
}
1;
I've gone through every post and still am having problems. Check out my site_html_template.pl code.
(By the way, I'm using the yahoo subcategories mod v2.0 and I've altered my nph-build.cgi per http://www.gossamer-threads.com/scripts/forum/resources/Forum3/HTML/004980.html.)
Code:
sub site_html_print_cat { # --------------------------------------------------------
# This routine determines how the list of categories will look.
# We now use a table to split the category name up into two columns.
# For each category you can use the following variables:
#
# $url : The URL to go to that category
# $category_name : The category name with _ and / removed.
# $category_descriptions{$subcat}: The category description (if any).
# $numlinks : The number of links inside that category (and subcategories).
# $mod : The newest link inside of that category.
#
my (@subcat) = @_;
my ($url, $numlinks, $mod, $subcat, $category_name, $description, $output, $i);
my ($half) = int (($#subcat+2) / 2);
# Print Header.
$output = qq|<div class="margin"><table width="100%" border="0" cellspacing="5" cellpadding="0"><tr><td class="catlist" valign="top">\n|;
foreach $subcat (sort @subcat) {
($description) = @{$category{$subcat}}[2];
# First let's get the name, number of links, and last modified date...
$url = "$build_root_url/" . &urlencode($subcat) . "/";
if ($subcat =~ m,.*/([^/]+)$,) { $category_name = &build_clean($1); } else { $category_name = &build_clean($subcat); }
$numlinks = $stats{"$subcat"}[0];
$mod = $stats{"$subcat"}[1];
# We check to see if we are half way through, if so we stop this table cell
# and begin a new one (this lets us have category names in two columns).
if ($i == $half) {
$output .= qq|</td><td class="catlist" valign="top">\n|;
}
$i++;
# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<dl><dt><a class="link" href="$url">$category_name</a> <small class="numlinks">($numlinks)</small> |;
$output .= qq|<font color="#FF0000"><small><sup class="new">new</sup></small></font>| if (&days_old($mod) < $db_new_cutoff);
$output .= qq|<BR></dt>|;
if ($description =~ m,^\(([^\)]+)\)(\d)$, && $#{$subcategories{$subcat}} >= 0) {
($description, $style) = ($1, $2);
$s = 0;
@subcatsub = split (/\|/, $description);
foreach $category_name (@subcatsub) {
foreach (sort @{$subcategories{$subcat}}) {
($description eq "ALL" && $#subcatsub == 0) ?
($_ =~ m,.*/([^/]+)$, and $category_name = &build_clean($1)) :
($_ eq "$subcat/$category_name" or next);
if ($style eq "1") {
$length += length($category_name);
($length > $subcat_length) and last;
}
if ($s > 0) {
$output .= qq~<font size="1">, </font>~ and $length += 2 if ($style eq "1");
$output .= qq~<font size="1"></font><BR>~ if ($style eq "2");
}
$url = "$build_root_url/" . &urlencode($_) . "/";
$output .= qq~<font size="1"> </font>~ if ($style eq "2");
$output .= qq~<font size="1"><A href="$url">$category_name</A></font>~;
$s++;
last if ($description ne "ALL" && $#subcatsub > 0);
}
}
undef $length;
if ($s < $#{$subcategories{$subcat}}) {
$output .= qq~<font size="1">...</font>~ if ($style eq "1");
}
}
$output .= qq|</dl>|;
}
# Don't forget to end the unordered list..
$output .= "</td></tr></table></div>\n";
return $output;
}
1;
sub site_html_print_subcat {
# --------------------------------------------------------
# This routine determines how the list of categories will look.
# We now use a table to split the category name up into two columns.
# For each category you can use the following variables:
#
# $url : The URL to go to that category
# $category_name : The category name with _ and / removed.
# $category_descriptions{$subcat}: The category description (if any).
# $numlinks : The number of links inside that category (and subcategories).
# $mod : The newest link inside of that category.
#
my (@subcat) = @_;
my ($url, $numlinks, $mod, $subcat, $category_name, $description, $output, $i);
my ($half) = int (($#subcat+2) / 2);
# Print Header.
$output = qq|<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top">\n|;
foreach $subcat (sort @subcat) {
($description) = @{$category{$subcat}}[2];
# First let's get the name, number of links, and last modified date...
$url = "$build_root_url/" . &urlencode($subcat) . "/";
if ($subcat =~ m,.*/([^/]+)$,) { $category_name = &build_clean($1); } else { $category_name = &build_clean($subcat); }
$numlinks = $stats{"$subcat"}[0];
$mod = $stats{"$subcat"}[1];
# We check to see if we are half way through, if so we stop this table cell
# and begin a new one (this lets us have category names in two columns).
if ($i == $half) {
$output .= qq|</td><td valign="top">\n|;
}
$i++;
# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<strong><href="$url">$category_name</a></strong>|;
$output .= qq|<small><sup "new">new</sup></small>| if (&days_old($mod) < $db_new_cutoff);
$output .= qq|<span "descript">$description </span>| if (!($description =~ /^[\s\n]*$/));
}
# Don't forget to end the unordered list..
$output .= "</table></div>\n";
return $output;
}
1;