Gossamer Forum
Home : General : Perl Programming :

$category

Quote Reply
$category
hi, this is a links question about the way the categories are displayed...
they are displayed like this is a table:

category1 category3
category2 category4
category5

and i was wondering if anyone knew howto change it so category5 (or the last category if the categories are un even) would be centered... like this:

category1 category3
category2 category4
.....category5

here is the category section (whats it called a function or sumthing like that?) in case anyone cares to help!


##########################################################
## Category Listings ##
##########################################################

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, $
my ($half) = int (($#subcat+2) / 2);

# Print Header.
$output = qq|<CENTER><TABLE BORDER=0 WIDTH="100%"><TR><TD VALIGN=TOP WI$

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); } e$
$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|</UL></TD><TD VALIGN=TOP WIDTH="50%">\n|;
}
$i++;


# Then we print out the name linked, new if it's new, and popular if its popula$
$output .= qq|<dl><dt><$font><strong><A HREF="$url">$category_name</A><$
$output .= qq|<$font_new><strong>new</strong></font>| if (&days$
$output .= qq|</dt>|;
$output .= qq|<dd><$font>$description </font></dd>| if (!($desc$
$output .= qq|</dl>|;

}

# Don't forget to end the unordered list..
$output .= "</TD></TR></TABLE></CENTER>\n";
return $output;
}

thanks for your help!