Gossamer Forum
Quote Reply
top5 global
I used the following global and then inserted the following on my index.html page
<%top5%>
<%loop top5_loop%>
<%Title%>: <%Hits%>
<%endloop%>

but nothing is showing up.. I am not sure what I have missed here so if anyone can point me in the right direction I would appreciate it. What I would really like is to list the top 5 rated sites on my home page not top hits but i can live with top hits if a rated global is not available.

----------------------------------------------------------------
This global will display the links in your database which have accumulated the most hits in descending order. It could be titled "top5".
sub {
my $tags = shift;
my $table = $DB->table('Links');
$table->select_options ('ORDER BY Hits DESC', 'LIMIT 5');
my $sth = $table->select;
my @output;
while (my $link = $sth->fetchrow_hashref) {
push (@output, $link);
}
return { top5_loop => \@output };
}
You can change the 'LIMIT' number to designate the number of links you want to be displayed. Insert the following loop in the desired template:
<%top5%>
<%loop top5_loop%>
<%Title%>: <%Hits%>
<%endloop%>
Added: Tue Dec 17 2002
Subject Author Views Date
Thread top5 global knewt 2297 Jan 1, 2003, 10:38 AM
Thread Re: [knewt] top5 global
Paul 2242 Jan 1, 2003, 10:47 AM
Thread Re: [Paul] top5 global
knewt 2226 Jan 1, 2003, 10:56 AM
Post Re: [knewt] top5 global
klauslovgreen 2221 Jan 1, 2003, 8:56 PM