Gossamer Forum
Home : Products : Links 2.0 : Customization :

Top 10 Cool Page - Not a top 10 - Why ??????

Quote Reply
Top 10 Cool Page - Not a top 10 - Why ??????
Another strange one here.

My Cool page --- I want to simply display the top 10 cool pages.

Sounds simple enough.

In my links.cfg I have set this to 10:-

# Build Options
# --------------------------------------------------------
# Setting for popular cutoff, can either be a percent (i.e. top 3%), or
# a fixed value (i.e. top 10). Enter 0.03 or 10 respectively.
$db_popular_cutoff = 10; # Top 3%

#########################################################

In my admin script when I build all I get this :-

Building What's Cool Page . . .
Cool Links: 14
Done

And rightfully enough 14 links are displayed.

I thought I may have had an error with the sub cool in nph.build but this looks ok too:-

sub build_cool_page {
# --------------------------------------------------------
# Creates a "What's Cool" page.

local ($total, $percent, $link_results, $title_linked);
my (%link_output, $category_clean);

if ($build_cool_path =~ m,^$build_root_path/(.*)$,) {
&build_dir ($1);
}

$total = 0;
CATEGORY: foreach $category (sort keys %cool_links) {
LINK: for ($i = 0; $i < ($#{$cool_links{$category}}+1) / ($#db_cols + 1); $i++) {
$total++;
%tmp = &array_to_hash ($i, @{$cool_links{$category}});
$link_output{$category} .= &site_html_link (%tmp) . "\n";
}
}
foreach $hit (sort {$b <=> $a} keys %cool_links) {
$link_results .= $link_output{$hit};
}



$title_linked = &build_linked_title ("Cool");
open (COOL, ">$build_cool_path/$build_index") or cgierr ("unable to open what's cool page: $build_cool_path/$build_index. Reason: $!");
print "\tCool Links: $total\n";
($db_popular_cutoff < 1) ?
($percent = $db_popular_cutoff * 100 . "%") :
($percent = $db_popular_cutoff);
print COOL &site_html_cool(@cool_links);
close COOL;
}

########################

Any ideas. If an obvious solution can't be seen.
Is there any way I can hard code the Sub_cool to give 10 links and by pass links.cfg



Stu2000 - The Ultimate World
http://www.world-porn.org/worldhackerz/
Quote Reply
Re: On form tonight !!!!!!! In reply to
$db_popular_cutoff is not a number of links - it is a decimal turned into a percentage so 0.10 would be 10%


Installs:http://wiredon.net/gt
FAQ:http://www.perlmad.com

Quote Reply
Re: On form tonight !!!!!!! In reply to
yeah but it says # Setting for popular cutoff, can either be a percent (i.e. top 3%), or
# a fixed value (i.e. top 10). Enter 0.03 or 10 respectively.

So the way I interpretate it in the example that 0.03 would be classed as the top 3% whereas going by the sub_cool its only a percentage if $db_popular_cutoff<1 else its a fixed value...
($db_popular_cutoff < 1) ?
($percent = $db_popular_cutoff * 100 . "%") :
($percent = $db_popular_cutoff);
print COOL &site_html_cool(@cool_links);
close COOL;
}

Is it me being a fool or have I wrongly interpretated.

If this is the case is there a way where I can only show for example the top 10 cool pages.



Stu2000 - The Ultimate World
http://www.world-porn.org/worldhackerz/
Quote Reply
Re: On form tonight !!!!!!! In reply to
Am I right, can this be done, and surely this is the way it should be done. I have seen quite a few sites around with top 10 hits pages. Is it a separate mod or is my scripts wrong ????

Stu2000 - The Ultimate World
http://www.world-porn.org/worldhackerz/
Quote Reply
Re: On form tonight !!!!!!! In reply to
I was going too ask the same qustion above, but thought it was too silly or I would get shouted at.

Is there a way to display 10 links. I also have it set to 10 and it displays 11 links on my whats cool page

Quote Reply
Re: On form tonight !!!!!!! In reply to
Don't think you can. You need to use decimal value. It would be very hard for the script to work out if it is a decimal you want, or a top-x.

Andy

webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: On form tonight !!!!!!! In reply to
In Reply To:
very hard for the script to work out if it is a decimal you want
Really Andy?

Links2 does that ALREADY

Code:
($db_popular_cutoff < 1) ?
($percent = $db_popular_cutoff * 100 . "%") :
($percent = $db_popular_cutoff);


Installs:http://wiredon.net/gt
FAQ:http://www.perlmad.com

Quote Reply
Re: On form tonight !!!!!!! In reply to
No guarantees but in sub build_cool_page in nph-build.cgi try changing:

Code:
LINK: for ($i = 0; $i < ($#{$cool_links{$category}}+1) / ($#db_cols + 1); $i++) {
to...

Code:
LINK: for ($i = 0; $i < 11; $i++) {
Installs:http://wiredon.net/gt
FAQ:http://www.perlmad.com

Quote Reply
Re: On form tonight !!!!!!! In reply to
Ooops Blush

Andy

webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: Top 10 Cool Page - Not a top 10 - Why ?????? In reply to
I have the same problem. Did you had chance to fix it?

Quote Reply
Re: Top 10 Cool Page - Not a top 10 - Why ?????? In reply to
Did this get resolved?

Listen to this.
I have the same problem. But I'm trying to get a Top 50 Cool Page. I have tried working out the percentage from the number of links I have (7257). To make the answer around 50 (the number I use is 0.0068, or there abouts). When it's building it says. 50 Links to be created. But the overall outcome is 214!!!!

Is there a hack/mod/anything that WILL make this work?

Also, if this is possible I would like to links in ascending order, not alphabetical! With the most popular at the top. Similar to how a toplist works I guess.......

Anyone available to help with this on going bug with Links2?

If I'm totally wrong and there is a MOD already solving this problem please let me know.

Thanks in advance.
Golden Eagle