Gossamer Forum
Quote Reply
New COOL page
Wondering on how to show a better What's Cool page like hotscripts have?
Here is the global:

sub { #show most pop by cat
my $tags = shift;
my $cat_db = $DB->table('Category');
my @root_cats = $cat_db->select (['Full_Name'], { FatherID => 0 })->fetchall_list;
my ($output,$nr,$link);
use GT::SQL::Condition;
foreach my $root_cat (sort @root_cats) {
#my $url = $cat_db->as_url($root_cat);
$output .=qq~<br><table border="0" width="94%" cellpadding="1" cellspacing="1">
<tr><td colspan="4" align="center" bgcolor="#666666" class="main_cat"><b>$root_cat</b></td></tr>
<tr bgcolor="#D5D5D5" align="center" class="regb">
<td width="5%"><b>Rank</b></td><td width="50%"><b>Title</b></td>
<td width="35%"><b>Author / Developer</b></td><td width="10%"><b>Hits</b></td>
my $search_db = $DB->table('Links','CatLinks','Category');
$search_db->select_options ('ORDER BY Hits DESC Limit 5');
my $sth = $search_db->select (['Links.ID', 'Links.Title', 'Links.Author', 'Links.Hits','Category.Full_Name', 'Category.Name'], GT::SQL::Condition->new(['Full_Name', 'LIKE', $root_cat .'%'], ['isValidated', '=', 'Yes']));
while ($link = $sth->fetchrow_hashref) {
$output .= qq~<tr bgcolor="#E9E9E9" class="desc">
<td align="center">$nr</td>
<td><a href="$CFG->{build_detail_url}/$link->{'ID'}$CFG->{build_extension}"><b>$link->{'Title'}</b></a></td>
#if($link->{'Author'} != "admin"){ $output .=qq~$link->{'Author'}~; }
#else{ $output .= "&nbsp;";}
$link->{'Author'}=~ s/admin/ /g;
$output .=qq~$link->{'Author'}</td><td>$link->{'Hits'}</td></tr>~;
$output .= qq~</table><br>~;
return $output;

Oh yeah, the code is a little messy but is working as planned.
Just replace the code in your cool page with a call to this global.
Since the global is a little tricky, don't ask me on how to modify it. If you don't know, don't use it.
You are welcome to improve it and post your version...
Maybe the HTML code can be at the template and a loop??
Have a nice day

Blondies can have brains (sometimes...)