Hi again. I have 2 new problems. See www.waterwater.ca.
This is what I have in sub site_html_print_cat:
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="0" cellpadding="0"><tr><td class="category" 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="category" valign="top">\n|;
}
$i++;
# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<strong><a class="link" href="$url">$category_name</a></strong> <small class="numlinks">($numlinks)</small> |;
$output .= qq|<small><sup class="new">new</sup></small>| if (&days_old($mod) < $db_new_cutoff);
$output .= qq|<br>|;
for (@{$subcategories{$subcat}}) {
if (m,^\Q$subcat\E/([^/]+)$,) {
$child = $1;
$clean = &build_clean($1);
$output .= qq|<a href="$build_root_url/$subcat/$child/"><font size="2">$clean</font></a>,|;
$output .= qq|<BR>| if $j == 2;
$j++;
if ($j == 4) {
$j = 0;
last;
}
}
}
$output =~ s/,$//;
$output .= qq|<br><br>|;
$output .= qq|<span class="descript">$description </span>| if (!($description =~ /^[\s\n]*$/));
}
# Don't forget to end the unordered list..
$output .= "</td></tr></table></div>\n";
return $output;
}
The problems are:
1. In the last category, Tanks, I have 2 subcategories, but only 1 shows up in this directory. If you click on Tanks, you will see that the second subcategory is actually there, but for some reason, it doesn't show in the main directory. This is the only category I'm having this problem with. Why?
2. In some categories, the subcategories are listed in 1 line, and others they go onto 2 lines. How do I get them to all go onto 1 line until they are too long, and then automatically wrap to the next line?
Thanks.
This is what I have in sub site_html_print_cat:
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="0" cellpadding="0"><tr><td class="category" 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="category" valign="top">\n|;
}
$i++;
# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<strong><a class="link" href="$url">$category_name</a></strong> <small class="numlinks">($numlinks)</small> |;
$output .= qq|<small><sup class="new">new</sup></small>| if (&days_old($mod) < $db_new_cutoff);
$output .= qq|<br>|;
for (@{$subcategories{$subcat}}) {
if (m,^\Q$subcat\E/([^/]+)$,) {
$child = $1;
$clean = &build_clean($1);
$output .= qq|<a href="$build_root_url/$subcat/$child/"><font size="2">$clean</font></a>,|;
$output .= qq|<BR>| if $j == 2;
$j++;
if ($j == 4) {
$j = 0;
last;
}
}
}
$output =~ s/,$//;
$output .= qq|<br><br>|;
$output .= qq|<span class="descript">$description </span>| if (!($description =~ /^[\s\n]*$/));
}
# Don't forget to end the unordered list..
$output .= "</td></tr></table></div>\n";
return $output;
}
The problems are:
1. In the last category, Tanks, I have 2 subcategories, but only 1 shows up in this directory. If you click on Tanks, you will see that the second subcategory is actually there, but for some reason, it doesn't show in the main directory. This is the only category I'm having this problem with. Why?
2. In some categories, the subcategories are listed in 1 line, and others they go onto 2 lines. How do I get them to all go onto 1 line until they are too long, and then automatically wrap to the next line?
Thanks.