Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Problems with category listing

Quote Reply
Problems with category listing
Hi guys,
I'm having some problems getting links to show my categories the right way.
The frontpage looks fine and half the sub categories do as well.
But, in the other half of the categories, the second column of categories are placed too far to the right.
I've been unable to find out why it happens, and am wondering of some of you might be able to figure it out.
The site is at http://www.cops.dk/ - one of the bad pages is found at http://www.cops.dk/Help_Needed/

I've made a border=1 to make it easier to see what's going on. The links part is acting weird as well, but I haven't had time to look at that yet.

I've included the site_html_print_cat from site_html_template.pl:

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);

# Print Header.
$output = qq|<div class="margin"><table width="80%" border="1" cellspacing="0" cellpadding="0"><tr><td class="catlist" align="left" valign="top">\n|;

foreach $subcat (sort @subcat) {
if ($subcat =~ m,.*/([^/]+)$,) { $category_name = &build_clean($1); } else { $category_name = &build_clean($subcat); }
if ($subcat =~ /\@$/) { ($subcat) = @{$category{$subcat}}[2]; }
($description) = @{$category{$subcat}}[2];
$url = "$build_root_url/" . &urlencode($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="catlist" width="50%" align="left" valign="top">\n|;
}
$i++;

# Then we print out the name linked, new if it's new, and popular if its popular.
if ($description eq "SUB1")
{ $output .= qq|<dl>|; }
$output .= qq|<dt>|;
if ($description eq "SUB1") {
$output .= qq|<strong>|; }
else
{ $output .= qq|&#149; |; }
$output .= qq|<a class="link" href="$url">$category_name</a>|;
if ($description eq "SUB1") {
$output .= qq|</strong>|; }
$output .= qq|<small class="numlinks">($numlinks)</small> |;
my $days_old = &days_old($mod);
if ($days_old <= 2) { $output .= qq| $new_1|; }
elsif ($days_old <= 7) { $output .= qq| $new_3|; }
elsif ($days_old <= 14) { $output .= qq| $new_7|; }
$output .= qq|</dt>|;
if ($#{$subcategories{$subcat}} >= 0 && $description =~ /^SUB.*/) {
$v = 0;
$sub_length = "";
$output .= qq|<small>|;
foreach $subcatsub (sort @{$subcategories{$subcat}}) {
$suburl = "$build_root_url/" . &urlencode($subcatsub) . "/";
if ($subcatsub =~ m,.*/([^/]+)$,) { $subcategory_name = &build_clean($1); }
else { $subcategory_name = &build_clean($subcatsub); }

$sub_length .= qq|, | if ($description =~ /1$/ && $v ne "0");
$sub_length .= qq|$subcategory_name| if ($description =~ /1$/);

if ($description =~ /1$/ && length($sub_length) > $subcat_length) {
$output .= qq|...|;
last;
}
else {
$output .= qq|, | if ($description =~ /1$/ && $v ne "0");
$output .= qq|
| if ($description =~ /2$/ || $v eq "0");
$output .= qq| | if ($description =~ /2$/);
$output .= qq|<a href="$suburl">$subcategory_name</a>|;
$v++;
0 }
}
$output .= qq|</small>|;
}
else {
$output .= qq|<dd><span class="descript">$description</span></dd>| if (!($description =~ /^[\s\n]*$/));
}
if ($description eq "SUB1")
{ $output .= qq|</dl>|; }
}

# Don't forget to end the unordered list..
$output .= "</dl></td></tr></table></div>\n";
return $output;
}
Any help is greatly appreciated :)

Jesper


Quote Reply
Re: Problems with category listing In reply to
The problem is with the following codes:

Code:

$output .= qq|</td><td class="catlist" width="50%" align="left" valign="top">\n|;


Change these code to the following:

Code:

$output .= qq|</td><td width="50%" valign="top">\n|;


What is screwing up the alignment are the following codes:

1) CSS - class="classlist"
2) align="left"

Good luck!

Regards,

Eliot Lee
Quote Reply
Re: Problems with category listing In reply to
Hi Eliot,
Thank you for your - as always - swift reply. Unfortunately it didn't solve the problem. I tried removing all class="classlist" and align="left" from the file, but it did not do any difference.
Do you have any other suggestions, that might help?

Thank you,

Jesper

Quote Reply
Re: Problems with category listing In reply to
Well...then I would recommend deleting all CSS references since the margin settings in the CSS file tend to screw up HTML formatting in most browsers.

Good luck!

Regards,

Eliot Lee