Gossamer Forum
Quote Reply
Last 5 on Cat
I want display last 5 link for category..
How I can Do it?
Thanks in andvance
Bye From Italy
Fabio

Quote Reply
Re: Last 5 on Cat In reply to
Please Help Me !!!!!

Quote Reply
Re: Last 5 on Cat In reply to
Help Me Please
Thanks in advance
Bye from Italy
Fabio

Fabio
Quote Reply
Re: Last 5 on Cat In reply to
fabio,

alex gave everyone a good starting point with

sub {
my $vals = shift;
my $link_db = $DB->table ('Links');
$link_db->select_options ('ORDER BY Hits DESC', 'LIMIT 5');
my $sth = $link_db->select;
my $output = '';
while (my $link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display('link', $link);
}
return $output;
}


have a look at the docs and modify the queries a bit. i'm tired.

Quote Reply
Re: Last 5 on Cat In reply to
where I must pt this code?
sub {
my $vals = shift;
my $link_db = $DB->table ('Links');
$link_db->select_options ('ORDER BY Hits DESC', 'LIMIT 5');
my $sth = $link_db->select;
my $output = '';
while (my $link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display('link', $link);
}
return $output;
}

Can U explain so weel?
Thanks Andy
Bye from Italy
Fabio

Fabio
Quote Reply
Re: Last 5 on Cat In reply to
See your similar post here:

http://www.gossamer-threads.com/...w=collapsed&sb=5


Note: the output will be formatted from the links.html template, the code needs some work to call a separate template so you could format to your liking.


________________________
Eraser
Insight Eye
http://www.insighteye.com
Quote Reply
Re: Last 5 on Cat In reply to
Fabio, it's just the global last 5 links, as written by alex and released in the docs. As eraser says, you need to put it in the global. If you want last 5 in cat, you'll need to add a few more qualifiers to it. It's under gt >> sql. Hope this helps.