Hi. How to display the top 10 and the last 10 links for each main category like hotscripts?
see hotscripts.com / New listing , Top Rating and Most Popular
For example, in a new template, how to display the same results like hotscripts for each main category?
In other words, this global works fine and display the most popular 10 links in each category, but How I can modify this global to display in another template the most popular links (by hits, or by another field add_date, etc.) only for one category, for example the id=4. ??
sub {
my ($rec) = @_;
my $id = $rec->{ID};
my $db = $DB->table ('Links','CatLinks');
$db->select_options ('ORDER BY Hits DESC', 'LIMIT 10');
my $sth = $db->select ( { 'CatLinks.CategoryID' => $id}, ['Links.ID', 'Links.Title', , 'Links.URL'], { isValidated => 'Yes'} );
my $popularcategory;
while (my ($id,$name,$url) = $sth->fetchrow_array) {
$popularcategory .= "<a href='$url'>$name</a><br>";
}
return $popularcategory;
}
Thank you very much.
see hotscripts.com / New listing , Top Rating and Most Popular
For example, in a new template, how to display the same results like hotscripts for each main category?
In other words, this global works fine and display the most popular 10 links in each category, but How I can modify this global to display in another template the most popular links (by hits, or by another field add_date, etc.) only for one category, for example the id=4. ??
sub {
my ($rec) = @_;
my $id = $rec->{ID};
my $db = $DB->table ('Links','CatLinks');
$db->select_options ('ORDER BY Hits DESC', 'LIMIT 10');
my $sth = $db->select ( { 'CatLinks.CategoryID' => $id}, ['Links.ID', 'Links.Title', , 'Links.URL'], { isValidated => 'Yes'} );
my $popularcategory;
while (my ($id,$name,$url) = $sth->fetchrow_array) {
$popularcategory .= "<a href='$url'>$name</a><br>";
}
return $popularcategory;
}
Thank you very much.