I've got my categories displaying horizontally across the page. The background color of my table cells is blue, so if the last row in a table has an uneven number of cells, the table is very visibly not squared off. Unfortunately I don't know how to write perl, so I need some help here.
I wonder if there's a way within the formula that calculates the value of the $half variable, to calculate the total count of categories, (is this the #subcat variable?), then subtract that number from the next highest multiple of the divisor of the category count, and then add the difference as that number of table cells.
So it would mean that if you were dividing 17 sub cats into 4 rows, it would figure out that the next multiple of 4 is 20 and so generate 3 extra table cells for you.
The relevant parts of site_html_templates.pl are below:
From sub site_html_print_cat
# Next line divides cat page into columns equal to the number after the / mark in the line
my ($half) = int ((($#subcat+2) / 4)+1);
# Next is step one to sort the categories horizontally with each category in it's own table cell
$output = qq|<div align="center"><table width="90%" border="0" cellspacing="0" cellpadding="3"><tr bgcolor="#BFD5F0">\n|;
# This puts the indicated table closing codes at the end of each category row
if ($i == $half) {
$output .= qq|</td>\n|;
$output .= qq|</tr>\n|;
$output .= qq|<tr>\n|;
$i = 0;
}
$i++;
# The extra number of table cells would go in this line where the cell with the nbsp is
$output .= "</td><td> </tr></table></div>\n";
return $output;
}
Thanks in advance for any help you can give.
Bobb Menk
bmenk@ll.mit.edu
I wonder if there's a way within the formula that calculates the value of the $half variable, to calculate the total count of categories, (is this the #subcat variable?), then subtract that number from the next highest multiple of the divisor of the category count, and then add the difference as that number of table cells.
So it would mean that if you were dividing 17 sub cats into 4 rows, it would figure out that the next multiple of 4 is 20 and so generate 3 extra table cells for you.
The relevant parts of site_html_templates.pl are below:
From sub site_html_print_cat
# Next line divides cat page into columns equal to the number after the / mark in the line
my ($half) = int ((($#subcat+2) / 4)+1);
# Next is step one to sort the categories horizontally with each category in it's own table cell
$output = qq|<div align="center"><table width="90%" border="0" cellspacing="0" cellpadding="3"><tr bgcolor="#BFD5F0">\n|;
# This puts the indicated table closing codes at the end of each category row
if ($i == $half) {
$output .= qq|</td>\n|;
$output .= qq|</tr>\n|;
$output .= qq|<tr>\n|;
$i = 0;
}
$i++;
# The extra number of table cells would go in this line where the cell with the nbsp is
$output .= "</td><td> </tr></table></div>\n";
return $output;
}
Thanks in advance for any help you can give.
Bobb Menk
bmenk@ll.mit.edu