Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Bug fix in HTML_Templates.pm

Quote Reply
Bug fix in HTML_Templates.pm
Found a small bug here that makes the subcategory page

Need to add this in under
sub site_html_print_cat {

or else you will have an extra <td></td> column at the beginning of the table.

If you want only two columns, I recommend that you put width='50%' in the <td> tag to make the columns even

<tr><td width="50%" class="catlist" valign="top">

To make the columns wider you can define
cellpadding="5" in the table tag.

Add this in

# 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 == 0){ #add
$i++; # add
next; # add
} # add

($i and ($i % $breakpoint)) or ($output .= qq|</td><td width="50%" class="catlist" valign="top">\n|);
$i++;
defined $dynamic and &load_user ($dynamic, $cat_r);
$output .= &load_template ('subcategory.html', { %$cat_r, %GLOBALS }, undef, $template);
Quote Reply
Re: Bug fix in HTML_Templates.pm In reply to
Whoops! Minor error in the fix.

Use this instead,

# 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 == 0){} #added
else { ($i and ($i % $breakpoint)) or ($output .= qq|</td><td width="50%" class="catlist" valign="top">\n|);} # modified

$i++;
defined $dynamic and &load_user ($dynamic, $cat_r);
$output .= &load_template ('subcategory.html', { %$cat_r, %GLOBALS }, undef, $template);

Also, if you want _ removed in Category names,

# Get the URL and the Category name.
$category_url = $LINKS{build_root_url} . "/" . &build_clean_name ($cat_r->{Name}) . "/";
($cat_r->{Name} =~ m,.*/([^/]+)$,) ? ($category_name = $1) : ($category_name = $cat_r->{Name});
$category_name =~ s/_/ /g; # add this in to remove _
$cat_r->{Short_Name} = $category_name;
$cat_r->{URL} = $category_url;
Quote Reply
Re: Bug fix in HTML_Templates.pm In reply to
I think you are right.
But how about this?
comment out:
Code:
$output = qq|<div class="margin"><table width="80%" border="0" cellspacing="0" cellpadding="0"><tr><td class="catlist" valign="top">\n|;

and modify:
Code:
($i and ($i % $breakpoint)) or ($output .= qq|</td><td class="catlist" valign="top">\n|);

to:
Code:
if ($i == 0) { $output = qq|<div class="margin"><table width="80%" border="0" cellspacing="0" cellpadding="0"><tr><td class="catlist" valign="top">\n|;
}
else { (($i % $breakpoint)) or ($output .= qq|</td><td width="50%" class="catlist" valign="top">\n|); }

[This message has been edited by Fortune (edited February 09, 2000).]

[This message has been edited by Fortune (edited February 09, 2000).]
Quote Reply
Re: Bug fix in HTML_Templates.pm In reply to
Seems like another way to do it.

Kevin