Replace the sub build rate page with this: sub build_rate_page {
# --------------------------------------------------------
# Creates a Top 10 hits page.
my (@values, $id, $hits, @top_votes, %top_votes);
local ($top_votes);
if ($build_ratings_path =~ m,^$build_root_path/(.*)$,) {
&build_dir ($1);
}
$total = 0;
open (LINKS, $db_links_name) or &cgierr ("unable to open links database: $db_links_name. Reason: $!");
LINE: while (<LINKS>) {
/^#/ and next LINE; # Skip comment Lines.
/^\s*$/ and next LINE; # Skip blank lines.
chomp;
@values = &split_decode ($_);
$id = $values[$db_key_pos];
$hits = $values[$db_hits];
next if ($hits < 10);
if (($#top_votes < 9) or ($hits > $top_votes[$#top_votes])) {
push (@{$top_votes{$hits}}, @values);
if ($#top_votes <= 10) {
push (@top_votes, $hits);
@top_votes = sort { $b <=> $a } @top_votes;
}
else {
splice (@{$top_votes{$#top_votes}}, 0, $#db_cols);
$#{$top_votes{$#top_votes}} or delete $top_votes{$#top_votes};
delete $top_votes{$top_votes[$#top_votes]-$id};
$top_votes[$#top_votes] = $hits;
@top_votes = sort { $b <=> $a } @top_votes;
}
}
}
close LINKS;
$top_votes = '';
foreach (sort { $b <=> $a } @top_votes) {
$seen{$_}++;
%link = &array_to_hash ($seen{$_} - 1, @{$top_votes{$_}});
$top_votes .= qq~<tr><td align=center>$link{'ID'}</td><td align=center>$link{'Hits'}</td><td><a href="$build_jump_url?ID=$link{$db_key}"
TARGET="_blank">$link{'Title'}</a></td></tr>\n~;
}
open (RATE, ">$build_ratings_path/$build_index") or &cgierr ("unable to open top rated page: $build_ratings_path/$build_index. Reason: $!");
print "\tVote Range: $top_votes[0] .. $top_votes[$#top_votes]\n";
print RATE &site_html_ratings;
close RATE;
}
And then get rid of this code in your site html templates.pl:
top_rated => $top_rated,
Then in top_rated.html delet the <%top_rated%> tag and alter the table
Good Luck!
Glenn
Host Links
http://cgi-resource.co.uk/links