This was a post to the wrong topic, but maybe I have an idea.
If you know the category ID, for example, when you are building a category page, or when you are in subcategory.html (such as when building the print_cat routine for the home page).
Anyway....
I really don't have time for this, and I've spent too much on it already.... (too many other things I really have to do) But... give this a try for a starting point:
$get_top5_links = $LINKDB->prepare (" SELECT * FROM Links WHERE CategoryID = ? ORDER BY Hits LIMIT 5 ");
Then, before where you added the $link_count variable, you want to calculate the top_5
my $top_links_count=0;
for my $i (0 .. 4) {
$tmp = $LINKDB->array_to_hash (${$get_top5_links_r}[$i]);
$tmp->{'links_count'}= ++$top_links_count;
$OUT{TOP5} .= &site_html_link ($tmp);
}
The "logic" (staying with the flow of Links SQL) is to create another output variable that contains the 5 top links as the values, rather than all the links, or categories, or whatever.
Examine those routines for what they are doing, and make the changes as needed to the starting code above.
[This message has been edited by pugdog (edited April 14, 2000).]
If you know the category ID, for example, when you are building a category page, or when you are in subcategory.html (such as when building the print_cat routine for the home page).
Anyway....
I really don't have time for this, and I've spent too much on it already.... (too many other things I really have to do) But... give this a try for a starting point:
Code:
Add this to the list after the big select statement: $get_top5_links = $LINKDB->prepare (" SELECT * FROM Links WHERE CategoryID = ? ORDER BY Hits LIMIT 5 ");
Then, before where you added the $link_count variable, you want to calculate the top_5
my $top_links_count=0;
for my $i (0 .. 4) {
$tmp = $LINKDB->array_to_hash (${$get_top5_links_r}[$i]);
$tmp->{'links_count'}= ++$top_links_count;
$OUT{TOP5} .= &site_html_link ($tmp);
}
The "logic" (staying with the flow of Links SQL) is to create another output variable that contains the 5 top links as the values, rather than all the links, or categories, or whatever.
Examine those routines for what they are doing, and make the changes as needed to the starting code above.
[This message has been edited by pugdog (edited April 14, 2000).]