Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Numbered top ten

Quote Reply
Numbered top ten
Hi,

I'm new with LSQL, I've used Links 2.0 before and now have some questions ... here is the first one:

I'm using a global to display the top 10 visited Links on my static start page;
Code:
sub {
my $tags = shift;
my $table = $DB->table('Links');
$table->select_options ('ORDER BY Hits DESC', 'LIMIT 10');
my $sth = $table->select;
my @output;
while (my $link = $sth->fetchrow_hashref) {
push (@output, $link);
}
return { top5_loop => \@output };
}

and in the template:

Code:
<%top5%>
<%loop top5_loop%>
<%body_font%><a class="category_links" target="_blank" href="<%db_cgi_url%>/jump.cgi?ID=<%ID%>"><%Title%></a>
<br>
<%Hits%> Besuche
<br>
<%endloop%>

Now I like to number the links from "1." to "10." ... as I don't know much about perl, any help is welcome ..

Kai
___________________________________________
http://www.westalgarve.de
http://www.portugalforum.org
http://www.portugal-links.de
Quote Reply
Re: [kailew] Numbered top ten In reply to
<%row_num%> should give you the row number.

Example;

Code:
<%top5%>
<%loop top5_loop%>
<%body_font%>
<%row_num%> : <a class="category_links" target="_blank" href="<%db_cgi_url%>/jump.cgi?ID=<%ID%>"><%Title%></a>
<br>
<%Hits%> Besuche <br>
<%endloop%>

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Numbered top ten In reply to
Hi Andy,

thx ... fast answer and works nice ...!

Kai
___________________________________________
http://www.westalgarve.de
http://www.portugalforum.org
http://www.portugal-links.de