i was wondering if someone could help me clean this up. i'm trying to get the top rated on my pages without ssi and i have this:
sub top_rated {
#-------------------------------------------
# Insert Top Five Rated Sites
open (NAME,"<$db_file_name") or &cgierr("error in numlinks. unable to open database:$db_links_name.\nReason: $!");
LINE: while(<NAME> ){
next LINE if (/^#/);
next LINE if (/^\s*$/);
@data=split (/\|/);
$tophits{$data[0]} = $data[21];
$name{$data[0]} = $data[1];
$url{$data[0]} = $data[2];
$rating{$data[0]} = $data[21];
}
close (NAME);
my $count=1;
foreach $field (sort { $tophits{$b} <=> $tophits{$a} } keys %tophits) {
if ($count <= 5) {
$output .= "<tr><td noWrap><a href=\"/cgi-bin/detail.cgi?ID=$field\" class=\"smallbody\">$name{$field}</a></td></tr>\n";
}
$count++;
}
return $output;
}
it's almost the same as my tophits:
sub top_five {
#-------------------------------------------
# Insert Top Five Sites
open (NAME,"<$db_file_name") or &cgierr("error in numlinks. unable to open database:$db_links_name.\nReason: $!");
LINE: while(<NAME> ){
next LINE if (/^#/);
next LINE if (/^\s*$/);
@data=split (/\|/);
$tophits{$data[0]} = $data[17];
$name{$data[0]} = $data[1];
$url{$data[0]} = $data[2];
$hits{$data[0]} = $data[17];
}
close (NAME);
my $count=1;
foreach $field (sort { $tophits{$b} <=> $tophits{$a} } keys %tophits) {
if ($count <= 5) {
$output .= "<tr><td noWrap><a href=\"/cgi-bin/detail.cgi?ID=$field\" class=\"smallbody\">$name{$field}</a></td></tr>\n";
}
$count++;
}
return $output;
}
now, it shows the top 5 rated, but still shows the top 5 hits right above it. what do i need to change to get rid of the top 5 hits to show just the top 5 rated in:
sub top_rated {
#-------------------------------------------
# Insert Top Five Rated Sites
open (NAME,"<$db_file_name") or &cgierr("error in numlinks. unable to open database:$db_links_name.\nReason: $!");
LINE: while(<NAME> ){
next LINE if (/^#/);
next LINE if (/^\s*$/);
@data=split (/\|/);
$tophits{$data[0]} = $data[21];
$name{$data[0]} = $data[1];
$url{$data[0]} = $data[2];
$rating{$data[0]} = $data[21];
}
close (NAME);
my $count=1;
foreach $field (sort { $tophits{$b} <=> $tophits{$a} } keys %tophits) {
if ($count <= 5) {
$output .= "<tr><td noWrap><a href=\"/cgi-bin/detail.cgi?ID=$field\" class=\"smallbody\">$name{$field}</a></td></tr>\n";
}
$count++;
}
return $output;
}
please help,
Blake
sub top_rated {
#-------------------------------------------
# Insert Top Five Rated Sites
open (NAME,"<$db_file_name") or &cgierr("error in numlinks. unable to open database:$db_links_name.\nReason: $!");
LINE: while(<NAME> ){
next LINE if (/^#/);
next LINE if (/^\s*$/);
@data=split (/\|/);
$tophits{$data[0]} = $data[21];
$name{$data[0]} = $data[1];
$url{$data[0]} = $data[2];
$rating{$data[0]} = $data[21];
}
close (NAME);
my $count=1;
foreach $field (sort { $tophits{$b} <=> $tophits{$a} } keys %tophits) {
if ($count <= 5) {
$output .= "<tr><td noWrap><a href=\"/cgi-bin/detail.cgi?ID=$field\" class=\"smallbody\">$name{$field}</a></td></tr>\n";
}
$count++;
}
return $output;
}
it's almost the same as my tophits:
sub top_five {
#-------------------------------------------
# Insert Top Five Sites
open (NAME,"<$db_file_name") or &cgierr("error in numlinks. unable to open database:$db_links_name.\nReason: $!");
LINE: while(<NAME> ){
next LINE if (/^#/);
next LINE if (/^\s*$/);
@data=split (/\|/);
$tophits{$data[0]} = $data[17];
$name{$data[0]} = $data[1];
$url{$data[0]} = $data[2];
$hits{$data[0]} = $data[17];
}
close (NAME);
my $count=1;
foreach $field (sort { $tophits{$b} <=> $tophits{$a} } keys %tophits) {
if ($count <= 5) {
$output .= "<tr><td noWrap><a href=\"/cgi-bin/detail.cgi?ID=$field\" class=\"smallbody\">$name{$field}</a></td></tr>\n";
}
$count++;
}
return $output;
}
now, it shows the top 5 rated, but still shows the top 5 hits right above it. what do i need to change to get rid of the top 5 hits to show just the top 5 rated in:
sub top_rated {
#-------------------------------------------
# Insert Top Five Rated Sites
open (NAME,"<$db_file_name") or &cgierr("error in numlinks. unable to open database:$db_links_name.\nReason: $!");
LINE: while(<NAME> ){
next LINE if (/^#/);
next LINE if (/^\s*$/);
@data=split (/\|/);
$tophits{$data[0]} = $data[21];
$name{$data[0]} = $data[1];
$url{$data[0]} = $data[2];
$rating{$data[0]} = $data[21];
}
close (NAME);
my $count=1;
foreach $field (sort { $tophits{$b} <=> $tophits{$a} } keys %tophits) {
if ($count <= 5) {
$output .= "<tr><td noWrap><a href=\"/cgi-bin/detail.cgi?ID=$field\" class=\"smallbody\">$name{$field}</a></td></tr>\n";
}
$count++;
}
return $output;
}
please help,
Blake