I would really like for the links to be sorted by popularity (most popular first).
Popularity being a function of hits and rating.
Logged In: NO
I achieved just that by changing the code below in links.cgi::display_cat:
# Initialize page navigation. if (!$start) { $start = 0; } # split and sort links for (my $i = $start; $i < @{$curcat}; $i++) { my @record = split(/\|/, $curcat->[$i]); $curcat->[$i] = \@record; } # 8 = rating, 6 = hits my @sorted = reverse sort {$a->[8] <=> $b->[8] || $a->[6] <=> $b->[6] } @$curcat; # Cycle through category and display all entries. my $num_shown = 0; foreach my $link (@sorted) { my ($lid, $name, $url, $desc, $date, $linkposter, $hits,
$votes, $rate) = @$link;
my $average_rate = 0;
Log in to post a comment.
Logged In: NO
I achieved just that by changing the code below in
links.cgi::display_cat:
$votes, $rate) = @$link;