Gossamer Forum
Home : Products : Links 2.0 : Customization :

How to modify the appearance of links in Top Rated page?

Quote Reply
How to modify the appearance of links in Top Rated page?
I would like the links that appear on the Top Rated page to include the cool graphic and to include the description for the link. Basically using the same format as the display for all the links on all the other pages.

I can find the line where I should change it in nph-build.cgi, but have no clue how to go about it. Any help would be appreciated.

I'm using Links 2 and templates.

Cheers!
lunaria
http://www.ya-hooka.com/

[This message has been edited by lunaria (edited April 09, 1999).]
Quote Reply
Re: How to modify the appearance of links in Top Rated page? In reply to
 
I'm not sure if you can create a template for this but the routine your looking for IS indeed in nph-build.cgi

Look for sub build_rate_page {

There is a section where it has table statements.. thats where it prints out how the links look. You can edit them there and that should fix you up.



------------------
The Crowe crowe@darkspiral.com
www.darkspiral.com
www.lit.org
Quote Reply
Re: How to modify the appearance of links in Top Rated page? In reply to
I've tracked it down to this line in nph-build.cgi in sub build_rate_page {...

$top_rated .= qq~<tr><td align=center>$link{'Rating'}</td><td align=center>$link{'Votes'}</td><td><a href="$link{'URL'}">$link{'Title'}</a></td></tr>\n~;

...however my programming skills are quite limited, and I'm not sure how to have it include the cool graphic, and the description. I tried copying code from site_html_template.pl, but I noticed there are differences in the language in those two files. Are there certain variables already defined that would have this info in it?


Quote Reply
Re: How to modify the appearance of links in Top Rated page? In reply to
Assuming your cool graphic is defined in site_html_templates.pl as "$new_img", change:

Quote:
$top_votes .= qq~<tr><td align=center>$link{'Rating'}</td><td align=center>$link{'Votes'}</td><td><a href="$link{'URL'}">$link{'Title'}</a></td></tr>\n~;

to read:

Quote:
$top_votes .= qq~<tr><td align=center>$link{'Rating'}</td><td align=center>$link{'Votes'}</td><td><a href="$link{'URL'}">$link{'Title'}</a>~;
if ($link{'isPop'}) { $top_votes .= qq~ $new_img~; }
if ($link{'Description'}) {$top_votes .= qq~<br>$link{'Description'}~; }
$top_votes .= qq~</td></tr>\n~;

Do the same for the $top_rated line, changeing $top_votes to $top_rated.

I hope this helps.

[This message has been edited by Bobsie (edited April 11, 1999).]
Quote Reply
Re: How to modify the appearance of links in Top Rated page? In reply to
Thanks for the help Bobsie. (Do you get paid for your excellent support work here?) Wink The description part worked great, however, I can't get it to include the "cool" logo. Here is the line you suggested.

if ($link{'isPop'}) { $top_votes .= qq~ $new_img~; }

Here's what I used, since i didn't have a $new_img, and the isPop is supposed to be isPopular i think.

if ($link{'isPopular'}) { $top_rated .= qq~<img src="/images/Ya-HookaHighLights.gif" alt="Ya-Hooka HighLights" border="0" width="69" height="20">~; }

This seems to put the cool image in for every link in the top rated page, not just those that have been "tagged" as cool.

If anyone has any suggestions i'd appreciate it.
Quote Reply
Re: How to modify the appearance of links in Top Rated page? In reply to
 
Quote:
Do you get paid for your excellent support work here?

Nope, it is all freely contributed. I have no official standing in Gossamer Threads.

Yup, you are right. It is "isPopular" not "isPop".

Quote:
This seems to put the cool image in for every link in the top rated page, not just those that have been "tagged" as cool.

Is it possible that all the top rated links are cool? Maybe that is why they show the graphic. Your code would certainly indicate it since it would not display the graphic if "isPopular" is No.
Quote Reply
Re: How to modify the appearance of links in Top Rated page? In reply to
I went back and double checked, and yes, it's putting a "cool" image next to them, even though they aren't popular. All I can think is that the ispopular variable is not set yet?

I looked through site_html_templates.pl it refers to isPopular in sub site_html_link

# Set new and pop to either 1 or 0 for templates.
($rec{'isNew'} eq 'Yes') ? ($rec{'isNew'} = 1) : (delete $rec{'isNew'});
($rec{'isPopular'} eq 'Yes') ? ($rec{'isPopular'} = 1) : (delete $rec{'isPopular'});

The isPopular does not appear in nph-build.cgi at all. But in sub build stats of nph-build.cgi, there is a line that goes like this.

push (@{$cool_links{$category}}, @values) if ($values[$db_ispop] eq "Yes");

So i was thinking that perhaps isPopular may not be the variable i should be testing for? Again, I'm pretty much clueless, but if you have any brilliant ideas, I'd appreciate it. Thanks again Bobsie, you are a great help Smile
Quote Reply
Re: How to modify the appearance of links in Top Rated page? In reply to
isPopular is the correct thing to be checking for. sub site_html_link does not get called by nph-build.cgi when building the Top Rated page and @cool_links is only used to build the Cool page.

The problem you are having is with your "if" statement. Change it like this:

Quote:
if ($link{'isPopular'} eq "Yes") { $top_rated .= qq~<img src="/images/Ya-HookaHighLights.gif" alt="Ya-Hooka HighLights" border="0" width="69" height="20">~; }

All you were doing was checking to see if $links{'isPopular'} was there, not what it contained. We both missed it.

By the way, are you aware that, as reported in another thread, your Top 40 has 42 links? I am not sure why the routine adds two more than the maximum, but I am trying to figure it out.
Quote Reply
Re: How to modify the appearance of links in Top Rated page? In reply to
Thanks again Bobsie, working just fine now.

p.s. That's odd about the 42, Top 40 sites... does anyone else have this problem? I double checked my code, and it's all ok.
Quote Reply
Re: How to modify the appearance of links in Top Rated page? In reply to
I believe I'm the other person having the problem that Bobsie was referring to. My top 10 shows 12 links in one section and 11 links in the other. I've tried adjusting hits, votes, and ratings to see if it had anything to do with "tie-breakers," but I can't find any pattern.

The only thing I can think of is that I changed my cutoff to make the list from 10 votes to 2 votes. I'm curious if this affects things somehow.

----
OK, for those of you that read this before I came back to edit it Smile, I couldn't keep my hands out of the cookie jar... I upped a few of the links so ten of them have at least 10 votes, then changed the top-10 minimum back to 10 votes, and guess what? It only shows ten on the top-10! Alex, any ideas why the code does that?

I also added # Hits into the top-10 lists, but I haven't done another list ranking by hits. Has anyone done this? Is it a matter of following the example of $top_votes and $top_rated in nph-build.cgi?

-----

Dan

------------------
My links are at: http://www.dankaplan.com/runninglinks

[This message has been edited by Dan Kaplan (edited April 26, 1999).]
Quote Reply
Re: How to modify the appearance of links in Top Rated page? In reply to
I have not had much experience customizing Links outside of the templates... how would I change the following line in nph-build.cgi, sub build_rate_page to reference the detailed view for that link as opposed to the off-site URL? Thanks.

<a href="$link{'URL'}">$link{'Title'}</a>
Quote Reply
Re: How to modify the appearance of links in Top Rated page? In reply to
Assuming that you have detailed building turned on, I think the following will work:

<a href="$build_detail_url/$link{'ID'}$build_extension">$link{'Title'}</a>

I hope this helps.

[This message has been edited by Bobsie (edited May 30, 1999).]
Quote Reply
Re: How to modify the appearance of links in Top Rated page? In reply to
Awesome, you're simply awesome! Thanks, Bobsie.