Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Sorry, have to ask again: what's cool sorted by hits

Quote Reply
Sorry, have to ask again: what's cool sorted by hits
Before everybody kills me, yes I know this has been discussed several times. But the only answers to my question I've been able to figure out from former threads are concerning template based Links (I always find the threads like these http://www.gossamer-threads.com/perl/search.cgi?query=cool+sort&bool=and&substring=1&forum=&date=&author=&search=Perform+Search ).
But I use non-templates.

So, is there anybody who could give me an advise how to sort the what's cool-page by klicks per link only?

Thanks,
Denis
Quote Reply
Re: Sorry, have to ask again: what's cool sorted by hits In reply to
Doesn't matter if you are using templates or not for re-writing the sorting routine. You have to edit the build_sorthit routine in the db_utils.pl file.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------









Quote Reply
Re: Sorry, have to ask again: what's cool sorted by hits In reply to
Sorry, the thing with templates and non was stupid, think I was too tired and still in another problem when typing this.

Anyway, at the moment I'm stopped with a 'out of memory' like the guy from New Zealand in this thread:
http://www.gossamer-threads.com/scripts/forum/resources/Forum3/HTML/003901.html

Can anyone tell me, why this error appears? I mean, it's been all running fine before - unless I tried out the little mod Jerry posted in above thread. It's 167 links only in the database, so not too many that can be considered cool (before it's been about 10). Maybe there's an unclosed loop somewhere?

I hate my non-knowledge of Perl, if I only had more time for this stuff! Keeps me so fixed...

Denis

[This message has been edited by Denis (edited February 15, 2000).]
Quote Reply
Re: Sorry, have to ask again: what's cool sorted by hits In reply to
I looked over Widgetz's codes and the syntax and logic seem to be fine.

Did you by chance neglect to also edit the sub build_sorthit routine as specified by Widgetz in that other Thread???

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------









Quote Reply
Re: Sorry, have to ask again: what's cool sorted by hits In reply to
I'm sorry, but I can't find anything mentioned about sub build_sorthit in this thread:
http://www.gossamer-threads.com/scripts/forum/resources/Forum3/HTML/003901.html

Also I cannot find sub build_sorthit in NPH-build.cgi or site_html.pl.

To make it easy without explaining 10 hours, here's my sub build_cool_page:

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 = int ($#cool_links+1)/($#db_cols + 1);
for ($i = 0; $i < $total; $i++) {
%tmp = &array_to_hash ($i, @cool_links);
# $link_results .= site_html_link (%tmp) . "\n"; Zeile entwertet von Denis Campbell, damit die Cool Links nicht überbewertet werden
$link_results .= &site_html_coollink (%tmp) . "\n";
$total++;
}

foreach $category (sort keys %cool_links) {
# ***************************************** nonenglish modification - begin ****************
# $category_clean = &build_clean ($category);
$category_clean = &kategorie_title_mb ($category);
# ***************************************** nonenglish modification - end ******************
$link_results .= qq|<span class="hinweistext">Zu finden in der Kategorie<br><$seiten_link> <A
onMouseOver="window.status='KLICK um die Kategorie einzusehen...'; return true;" onMouseOut="window.status=''; return true;"
HREF="$build_root_url/$category/$build_index">$category_clean</a></span>\n|;
$link_results .= $link_output{$category};
}
$title_linked = &build_linked_title ("Die bestbesuchten-Seiten");
open (COOL, ">$build_cool_path/$build_index") or cgierr ("unable to open what's cool page: $build_cool_path/$build_index. Reason: $!");
print "\tEs sind insgesamt <strong>$total coole Seiten</strong> vorhanden.\n";
($db_popular_cutoff < 1) ?
($percent = $db_popular_cutoff * 100 . "%") :
($percent = $db_popular_cutoff);
print COOL &site_html_cool(@cool_links);
close COOL;
}

For the moment I left the stuff that shows up the categories, because I'd like to have them mentioned but not be cared for when sorting. Of course I tried it also with commenting out those lines, but the result was the same, so that's why they're still there. So I believe the part from the non-english mod is also not disturbing.

Any ideas?
Denis
Quote Reply
Re: Sorry, have to ask again: what's cool sorted by hits In reply to
Noone? There must be something wrong, it's so few links only. I can't figure it out by myself...
Quote Reply
Re: Sorry, have to ask again: what's cool sorted by hits In reply to
Sorry...I meant to write the sub build_stat routine in the nph-build.cgi file, which IS mentioned in the other Thread you provided.

Wink

Look at the other Thread more carefully. I looked at the codes you posted and you have not made any changes to the sub build_stat routine.

Regards,


------------------
Eliot Lee
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------











Quote Reply
Re: Sorry, have to ask again: what's cool sorted by hits In reply to
.. spent the whole morning to check if I missed something. But I don't think so. Also the stuff with push (blabla) has been entered as per Widgetz instructions.

Did he mean that I should replace sub build_stats with sub build_cool_page or add sub build_cool_page within sub build_stats - or even outside, i.e. at the end of the script?

So far I tried out both, but NPH-build.cgi just returns that out of memory (when I check the script with Perl-Checker, within admin.cgi it just stops when building the cool page and never comes to an end).

Grrr, what could that be?
Quote Reply
Re: Sorry, have to ask again: what's cool sorted by hits In reply to
Replace....

Quote:
change sub to

means replace...

Quote:
change

means change...

Again...look at the Thread more carefully!

Regards,

------------------
Eliot Lee
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------