Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Number of links not correct

Quote Reply
Number of links not correct
Hello,
The number of links in each category is not showing properly. I have added 220 links to one category and on the main page it shows one link in all sub categories. When I go to the sub category it shows no link in all except one sub, and that shows just one link also.

Can not find out where the problem could be.

Thanks,
Larry
Quote Reply
Re: Number of links not correct In reply to
 Placed original files on the server.
Built site using the same link.db. All links show the number of links on the home page properly now.

When I click to go to the subs the links show only number of links on the subs that have no other sub categories under them.

I know some of the categories have sub categories that have links in them.

I am totally confused with this now.

Larry
Quote Reply
Re: Number of links not correct In reply to
Forget last post!!!

I forgot there is this thing called a refresh button!!!!

Larry
Quote Reply
Re: Number of links not correct In reply to
What have you changed (if anything) in link.html and/or sub site_html_print_cat of site_html_templates.pl?

Those are the places that affect the output number of links per category/subcategory.

Dan
Quote Reply
Re: Number of links not correct In reply to
Here is what I have.

Also all links are new that I added but only shows one link as being new.

Did you mean category.html or link.html for the other file?

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="0" cellspacing="0" cellpadding="0"><tr><td class="catlist" valign="top">\n|;

foreach $subcat (sort @subcat) { my $mod = $stats{"$subcat"}[3];
my $new_add = $stats{"$subcat"}[4];
($description) = @{$category{$subcat}}[2];
($subcatstyle) = @{$category{$subcat}}[9];



# 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];

# 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" valign="top">\n|;
}
$i++;

# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<a class="catlist" href="$url">$category_name</a> <font size="-3">($numlinks)</font> |;
$output .= qq|<small><sup class="new">new</sup></small>| if (&days_old($mod) < $db_new_cutoff);
$output .= qq|<BR>|;
if ($subcatstyle =~ m,^\(([^\)]+)\)(\d)$, && $#{$subcategories{$subcat}} >= 0) {
($subcatstyle, $style) = ($1, $2);
$s = 0;
@subcatsub = split (/\|/, $subcatstyle);
$output .= qq~ ~ if ($style eq "1");
foreach $category_name (@subcatsub) {
foreach (sort @{$subcategories{$subcat}}) {
($subcatstyle eq "ALL" && $#subcatsub == 0) ?
($_ =~ m,.*/([^/]+)$, and $category_name = &build_clean($1)) :
($_ eq "$subcat/$category_name" or next);
if ($style eq "1") {
$length += length($category_name);
($length > $subcat_length) and last;
}
if ($s > 0) {
$output .= qq~, ~ and $length += 2 if ($style eq "1");
$output .= qq~ ~ if ($style eq "2");
}
$url = "$build_root_url/" . &urlencode($_) . "/";
$output .= qq~<LI>~ if ($style eq "2");
$output .= qq~<font size=\"1\"><a href="$url">$category_name</a><\/font>~;
$s++;
last if ($subcatstyle ne "ALL" && $#subcatsub > 0);
}
}
undef $length;
if ($s < $#{$subcategories{$subcat}}) {
$output .= qq~...~ if ($style eq "1");
}
$output .= qq~<BR>~;
}
else { }}

# Don't forget to end the table..
$output .= "</td></tr></table></div>\n";
return $output;
}

1;

Thank you,
Larry


[This message has been edited by NewToThis (edited April 16, 2000).]
Quote Reply
Re: Number of links not correct In reply to
Hi Larry,

Well, I was hoping you'd just post what you changed so I don't have to look through your code... Anyway, I'm not familiar with this bit:
Code:
foreach $subcat (sort @subcat) { my $mod = $stats{"$subcat"}[3];
my $new_add = $stats{"$subcat"}[4];
($description) = @{$category{$subcat}}[2];
($subcatstyle) = @{$category{$subcat}}[9];
I'm guessing it's one of the subcategory mods (which seem to cause people a lot of problems setting up), but I'm not familiar with them. I would suggest going back to an unmodified installation, see if it works right for you, then change one thing at a time.

Dan
Quote Reply
Re: Number of links not correct In reply to
Ok,

When I build the site:
Staggered (Auto)the numbers change in the sub categories (again not all are showing but the numbers are closer to being correct)

Will do like you suggested Dan,
Thank you for your help
Larry
Quote Reply
Re: Number of links not correct In reply to
Glad to hear you figured it out while I was away. Smile

I don't know what I was thinking when I mentioned link.html....

Dan