Gossamer Forum
Quote Reply
Top Rated
I want to show top rated listing like this site:
http://www.archaeologie-online.de/links/top/
How I can make it?

Thanks in advance
Fabio
Bye from Italy

Quote Reply
Re: Top Rated In reply to
Contact Digger via Private Message or email.

Regards,

Eliot Lee
Quote Reply
Re: Top Rated In reply to
Hi,
In Reply To:
I want to show top rated listing like this site:
http://www.archaeologie-online.de/links/top/
How I can make it?
First, you have to edit the template top_rated.html to set the correct number of columns for the table where the links are shown.

Second, you have to change some lines in admin/Links/Build.pm in sub build_rating:

Code:
# Now build the html.
$top_rated = ''; $top_votes = '';
$min_v = 99999999; $max_v = 0; my $topnumber = 1;
while ($link = $voted->fetchrow_hashref) {
$min_v = $link->{'Votes'} if ($min_v > $link->{'Votes'});
$max_v = $link->{'Votes'} if ($max_v < $link->{'Votes'});
#-----> Modification: changed html in the following line(s)
$top_votes .= qq~
<tr>
<td align="center" valign="top" rowspan="2"><b>$topnumber</b></td>
<td width="100%"><a href="${$link}{'URL'}" target="_blank">${$link}{'Title'}</a></td>
<td align="center" valign="top"><b>${$link}{'Votes'}</b></td>
<td align="right" valign="top">${$link}{'Rating'}</td>
</tr><tr>
<td colspan="3">${$link}{'Description'}</td>
</tr>\n~;

$topnumber ++;
}
$min_r = 99999999; $max_r = 0; my $topnumber = 1;
while ($link = $rated->fetchrow_hashref) {
$min_r = $link->{'Votes'} if ($min_r > $link->{'Votes'});
$max_r = $link->{'Votes'} if ($max_r < $link->{'Votes'});
#-----> Modification: changed html in the following line(s)
$top_rated .= qq~
<tr>
<td align="center" valign="top" rowspan="2"><b>$topnumber</b></td>
<td width="100%"><a href="${$link}{'URL'}" target="_blank">${$link}{'Title'}</a></td>
<td align="right" valign="top"><b>${$link}{'Rating'}</b></td>
<td align="center" valign="top">${$link}{'Votes'}</td>
</tr><tr><td colspan="3">${$link}{'Description'}</td>
</tr>\n~;

$topnumber ++;
}
I added the code that is marked red to number the top rated links from 1 to 10. Also I inserted ${$link}{'Description'} to show the link description.
Note that this will not look exactly like my top rated page because I removed some of the formatting which is done with style sheets and would not make sense to quote here.
Note also that the lines marked blue are indeed only one line in the original code. I broke them down for better readability in this forum.

To Alex:
It seems to me that this formatting should better be done in the template itself. Wouldn't it be possible to do that via tags and loops in the template?
Just a suggestion, don't know if that is possible at all Wink

Andreas
http://www.archaeologie-online.de
Quote Reply
Re: Top Rated In reply to
You'd probably have good results formatting in the template, but you'd need to change the passed values to an array of hashes, in order to use "loop".

You can get an idea of how to do it if you look at page.cgi, and the differences between 2.02 and 2.04 in sending out the <%link_results%> tag.

I can post something on this later, since I've converted a few of my scripts to using this process, and my UploadLogo etc programs use <%loop%> rather than a passed pre-formatted set of values, so you can edit a small code fragment to change the look of the links, but not have to edit your templates or code at all.

PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum