I've posted this inquiry a couple of times already - I apologize for taking up extra space - but I'm really baffled. Can anyone out there tell me what the heck is wrong with this code that it prints all of my categories in only one column? It's straight from the script resources template and incorporates RedRum's subcategories mod. I will be so eternally grateful if someone can help me figure this out:
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);
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];
# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<tr><td><font face="Verdana, Helevtica, Arial" size=2><dl><dt><strong><a href="$url">$category_name</a></strong> <small class="numlinks">($numlinks)</small> |;
$output .= qq|<small><font color="red">new</font></small>| if (&days_old($mod) < $db_new_cutoff);
$output .= qq|</dt>|;
$output .= qq|<br><small>| . qq| | x 4;
$j=0;
for (@{$subcategories{$subcat}}) {
if (m,^\Q$subcat\E/([^/]+)$,) {
$child = ($1);
if ($hyperlink) {
$output .= qq|<a href="$build_root_url/$subcat/$child/">$child</a>,|
}
else {
$output .= qq|$child,|
}
$j++;
if ($j == $max_subs) {
last;
$j = 0;
}
}
}
chop $output;
$output .= qq|</small><br>|;
$output .= qq|<dd><span class="descript">$description </span></dd>| if (!($description =~ /^[\s\n]*$/));
$output .= qq|</dl></font></td></tr>|;
}
return $output;
}
1;
Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
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);
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];
# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<tr><td><font face="Verdana, Helevtica, Arial" size=2><dl><dt><strong><a href="$url">$category_name</a></strong> <small class="numlinks">($numlinks)</small> |;
$output .= qq|<small><font color="red">new</font></small>| if (&days_old($mod) < $db_new_cutoff);
$output .= qq|</dt>|;
$output .= qq|<br><small>| . qq| | x 4;
$j=0;
for (@{$subcategories{$subcat}}) {
if (m,^\Q$subcat\E/([^/]+)$,) {
$child = ($1);
if ($hyperlink) {
$output .= qq|<a href="$build_root_url/$subcat/$child/">$child</a>,|
}
else {
$output .= qq|$child,|
}
$j++;
if ($j == $max_subs) {
last;
$j = 0;
}
}
}
chop $output;
$output .= qq|</small><br>|;
$output .= qq|<dd><span class="descript">$description </span></dd>| if (!($description =~ /^[\s\n]*$/));
$output .= qq|</dl></font></td></tr>|;
}
return $output;
}
1;
Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund