Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Re: Number of links not correct

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).]
Subject Author Views Date
Thread Number of links not correct NewToThis 2437 Apr 16, 2000, 7:15 AM
Post Re: Number of links not correct
NewToThis 2376 Apr 15, 2000, 9:32 PM
Post Re: Number of links not correct
NewToThis 2376 Apr 15, 2000, 9:34 PM
Post Re: Number of links not correct
Dan Kaplan 2377 Apr 16, 2000, 7:38 AM
Post Re: Number of links not correct
NewToThis 2373 Apr 16, 2000, 7:46 AM
Post Re: Number of links not correct
Dan Kaplan 2389 Apr 16, 2000, 8:30 AM
Post Re: Number of links not correct
NewToThis 2369 Apr 16, 2000, 8:37 AM
Post Re: Number of links not correct
Dan Kaplan 2381 Apr 16, 2000, 11:43 AM