Gossamer Forum
Home : Products : Links 2.0 : Customization :

Changing link reference in top rated build

Quote Reply
Changing link reference in top rated build
I'm not using external links and only a few links have detailed pages. If a link is in the top rated page, it's hyperlink goes to it's detail page now, but I can't seem to find a way to turn off the link if it doesn't have a detail page. Thanks to PaulWilson, I was able to turn the detail pages off for certain links and I'm trying to incorporate that same command into this:


$top_rated = ''; $top_votes = '';

foreach (sort { $b <=> $a } @top_votes) {
$seen{$_}++;
%link = &array_to_hash ($seen{$_} - 1, @{$top_votes{$_}});
if (!$values[$db_detailed]);{
$top_votes .= qq~<tr><td align=center>$link{'Rating'}</td><td align=center>$link{'Votes'}</td><td><a

href="$db_cgi_url/detailed.cgi?ID=$link{'ID'}">$link{'Title'}</a></td></tr>\n~;
}
}
else {
$top_votes .= qq~<tr><td align=center>$link{'Rating'}</td><td align=center>$link{'Votes'}</td><td><a

href="$db_cgi_url/detailed.cgi?ID=$link{'ID'}">$link{'Title'}</a></td></tr>\n~;
}
}
foreach (sort { $b <=> $a } @top_rate) {
$seen{$_}++;
%link = &array_to_hash ($seen{$_} - 1, @{$top_rate{$_}});
$top_rated .= qq~<tr><td align=center>$link{'Rating'}</td><td align=center>$link{'Votes'}</td><td><a

href="$db_cgi_url/detailed.cgi?ID=$link{'ID'}">$link{'Title'}</a></td></tr>\n~;
}
open (RATE, ">$build_ratings_path/$build_index") or &cgierr ("unable to open top rated page: $build_ratings_path/$build_index. Reason:

$!");
print "\tVote Range: $top_votes[0] .. $top_votes[$#top_votes]\n";
print "\tRate Range: $top_rate[0] .. $top_rate[$#top_rate]\n";
print RATE &site_html_ratings;
close RATE;
}


If anyone has any other suggestions I'd appreciate it.

Steve

Perl Hopefull
Quote Reply
Re: Changing link reference in top rated build In reply to
This

if (!$values[$db_detailed]);{

will give an error due to the ;

Try....

if (!$link{'Detailed'}) {

Remember to change Detailed to the correct field name

Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Quote Reply
Re: Changing link reference in top rated build In reply to
Thanks Paul, but I didn't even make it to the error page...I found several things out of place and worked with it some more. Here's what I have so far without errors, but still makes a hyperlink for each listing. The 'detailed' it references is a checkbox field. If it's checked, it builds the detail page...if not...well, you get the idea Smile

$top_rated = ''; $top_votes = '';
if (!$link{'Detailed'}) {
foreach (sort { $b <=> $a } @top_votes) {
$seen{$_}++;
%link = &array_to_hash ($seen{$_} - 1, @{$top_votes{$_}});
$top_votes .= qq~<tr><td align=center>$link{'Rating'}</td><td align=center>$link{'Votes'}</td><td><a

href="$db_cgi_url/detailed.cgi?ID=$link{'ID'}">$link{'Title'}</a></td></tr>\n~;
}
}
else {
foreach (sort { $b <=> $a } @top_votes) {
$seen{$_}++;
%link = &array_to_hash ($seen{$_} - 1, @{$top_votes{$_}});
$top_votes .= qq~<tr><td align=center>$link{'Rating'}</td><td align=center>$link{'Votes'}</td><td>$link{'Title'}</td></tr>\n~;
}
}
if (!$link{'Detailed'}) {
foreach (sort { $b <=> $a } @top_rate) {
$seen{$_}++;
%link = &array_to_hash ($seen{$_} - 1, @{$top_rate{$_}});
$top_rated .= qq~<tr><td align=center>$link{'Rating'}</td><td align=center>$link{'Votes'}</td><td><a

href="$db_cgi_url/detailed.cgi?ID=$link{'ID'}">$link{'Title'}</a></td></tr>\n~;
}
}
else {
foreach (sort { $b <=> $a } @top_rate) {
$seen{$_}++;
%link = &array_to_hash ($seen{$_} - 1, @{$top_rate{$_}});
$top_rated .= qq~<tr><td align=center>$link{'Rating'}</td><td align=center>$link{'Votes'}</td><td>$link{'Title'}</td></tr>\n~;
}
}

Perl Hopefull
Quote Reply
Re: [stilton] Changing link reference in top rated build In reply to
This allow to control the links in the top rate page ! Very nice!



Just want to add the mod guide



Replace this code in nph-build.cgi

Code:


$top_rated = ''; $top_votes = '';



foreach (sort { $b <=> $a } @top_votes) {

$seen{$_}++;

%link = &array_to_hash ($seen{$_} - 1, @{$top_votes{$_}});

$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~;

}

foreach (sort { $b <=> $a } @top_rate) {

$seen{$_}++;

%link = &array_to_hash ($seen{$_} - 1, @{$top_rate{$_}});

$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~;

}




for this one

Code:
$top_rated = ''; $top_votes = '';
if (!$link{'Detailed'}) {
foreach (sort { $b <=> $a } @top_votes) {
$seen{$_}++;
%link = &array_to_hash ($seen{$_} - 1, @{$top_votes{$_}});
$top_votes .= qq~<tr><td align=center>$link{'Rating'}</td><td align=center>$link{'Votes'}</td><td><a

href="$db_cgi_url/detailed.cgi?ID=$link{'ID'}">$link{'Title'}</a></td></tr>\n~;
}
}
else {
foreach (sort { $b <=> $a } @top_votes) {
$seen{$_}++;
%link = &array_to_hash ($seen{$_} - 1, @{$top_votes{$_}});
$top_votes .= qq~<tr><td align=center>$link{'Rating'}</td><td align=center>$link{'Votes'}</td><td>$link{'Title'}</td></tr>\n~;
}
}
if (!$link{'Detailed'}) {
foreach (sort { $b <=> $a } @top_rate) {
$seen{$_}++;
%link = &array_to_hash ($seen{$_} - 1, @{$top_rate{$_}});
$top_rated .= qq~<tr><td align=center>$link{'Rating'}</td><td align=center>$link{'Votes'}</td><td><a

href="$db_cgi_url/detailed.cgi?ID=$link{'ID'}">$link{'Title'}</a></td></tr>\n~;
}
}
else {
foreach (sort { $b <=> $a } @top_rate) {
$seen{$_}++;
%link = &array_to_hash ($seen{$_} - 1, @{$top_rate{$_}});
$top_rated .= qq~<tr><td align=center>$link{'Rating'}</td><td align=center>$link{'Votes'}</td><td>$link{'Title'}</td></tr>\n~;
}
}



Where if you use detailed pages and want the visitors on the top rate page to go to the detaill page chage:



$db_cgi_url/detailed.cgi?ID=$link{'ID'}

for example:

url_to_your_detail_page/$link{'ID'}.html
Regards,