Gossamer Forum
Home : Products : Links 2.0 : Customization :

Links as Voting Topsites?

Quote Reply
Links as Voting Topsites?
Hi,

whats about making Links a Voting-Topsites with categorys?

External rating and a Top 10 for every category should do the job :-)

Has someone done this already?

Karl
Quote Reply
Re: Links as Voting Topsites? In reply to
it's really easy to do.. i already made a mod to do top X for each category..

jerry

[This message has been edited by widgetz (edited October 16, 1999).]
Quote Reply
Re: Links as Voting Topsites? In reply to
Hi widgetz,

can i take a look at it?

Karl
Quote Reply
Re: Links as Voting Topsites? In reply to
Code:
sub build_top_x {
my ($category) = @_;
my (@values, $top_cat, @topx, $topxhtml, $count);

open (DB, "<$db_file_name") or &cgierr("unable to open database: $db_file_name.\nReason: $!");
LINE: while (<DB> ) {
/^#/ and next LINE; # Skip comment Lines.
/^\s*$/ and next LINE; # Skip blank lines.
chomp; # Remove trailing new line.
@values = &split_decode($_);
$top_cat = $values[$db_category];
next unless ($top_cat =~ /^$category/);
push (@topx, @values);
}

$db_sort_links = "14";
@topx = &build_sorthit (@topx);
$db_sort_links = "1";
close DB;

$topxhtml = qq~<table cellpadding="0" cellspacing="0" border="0">\n~;
my $display = 5;
(($#topx+1) / ($#db_cols+1) >= 5) or $display = ($#topx+1)/($#db_cols+1);
for ($i = 0; $i < $display; $i++) {
%tmp = &array_to_hash ($i, @topx);
$count = $i+1;
$topxhtml .= qq~<tr><td valign="top"><$font><b>$count.</b></font> </td><td valign="top"><$font>~;
if ($tmp{'isDetailed'} eq "Yes") { $topxhtml .= qq~<a href="$build_detail_url/$tmp{$db_key}$build_extension"><b>$tmp{'Title'}</b></a>~; }
else { $topxhtml .= qq~<a href="$build_jump_url?$db_key=$tmp{$db_key}"><b>$tmp{'Title'}</b></a>~; }
$topxhtml .= qq~</font><br><$font_small>($tmp{'Hits'} Downloads)</font></td></tr>\n~;
}

$topxhtml .= qq~</table>~;

return $topxhtml;
}

you'd do something like

$top = &build_top_x ($cat);

in the category subroutine..

you will need the build_sorthit used with review.cgi 1...
http://www.widgetz.com/review/?1

keep pressing next until you make it to db_utils.pl

jerry

[This message has been edited by widgetz (edited October 17, 1999).]
Quote Reply
Re: Links as Voting Topsites? In reply to
Hi widgetz,

thanks a lot for your help!

Karl

Quote Reply
Re: Links as Voting Topsites? In reply to
Jerry,

Great Mod...however, when I added it, I got an Out of Memory Error.

(Yes, I am building my index via telnet.)

Wink

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited October 17, 1999).]
Quote Reply
Re: Links as Voting Topsites? In reply to
oh.. yea.. i just remember that it loads the links.db every single category Wink

there is a better way however.. to not load it..

stupid me Wink

Code:
sub build_top_x {
my ($category) = @_;
my (@values, $top_cat, @topx, $topxhtml, $count);
$db_sort_links = "14";
@topx = &build_sorthit (@{$links{$category}});
$db_sort_links = "1";

$topxhtml = qq~<table cellpadding="0" cellspacing="0" border="0">\n~;
my $display = 5;
(($#topx+1) / ($#db_cols+1) >= 5) or $display = ($#topx+1)/($#db_cols+1);
for ($i = 0; $i < $display; $i++) {
%tmp = &array_to_hash ($i, @topx);
$count = $i+1;
$topxhtml .= qq~<tr><td valign="top"><$font><b>$count.</b></font> </td><td valign="top"><$font>~;
if ($tmp{'isDetailed'} eq "Yes") { $topxhtml .= qq~<a href="$build_detail_url/$tmp{$db_key}$build_extension"><b>$tmp{'Title'}</b></a>~; }
else { $topxhtml .= qq~<a href="$build_jump_url?$db_key=$tmp{$db_key}"><b>$tmp{'Title'}</b></a>~; }
$topxhtml .= qq~</font><br><$font_small>($tmp{'Hits'} Downloads)</font></td></tr>\n~;
}
$topxhtml .= qq~</table>~;
return $topxhtml;
}

i forgot to tell you

the first:
Code:
$db_sort_links = "14";

change the number to the field number of Hits

and then

the second one to the original one you have in links.def

jerry
Quote Reply
Re: Links as Voting Topsites? In reply to
Jerry,

Hi...okay, I understand the number of the first variable, but I don't understand:

Code:
top => $top,

Then in your category.html file, add the following tag in the spot where want these top sites to appear:

Code:
<%top%>

I also changed the jump.cgi codes to $tmp{'URL'} to avoid the problems that arise with people clicking on links many times to increase their hits and subsequently have their sites stay in the Top Sites area.

Thanks again, Jerry!

Smile

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited October 17, 1999).]

[This message has been edited by Eliot (edited October 17, 1999).]
Quote Reply
Re: Links as Voting Topsites? In reply to
go to links.def and you will see it.. Wink

it's because you have to switch it back to the original one in order for it to sort the other pages right.. you could do this

Code:
$original = $db_sort_links;
$db_sort_links = $db_def{'Hits'}[0];
@topx = &build_sorthit (@{$links{$category}});
$db_sort_links = $original;

and then you won't need to edit anything..

jerry
Quote Reply
Re: Links as Voting Topsites? In reply to
Hmmm,

I dont quite follow all these variations in installing such a Mod.

Ok Eliot you said for template users, put the top => $top; into the template_html.pl

I did that and used the <%top%> and got no change when I built the pages.

I used Widgetz db_utils.db modification, and added the code he posted into my nph-build.cgi.

Is there anything I am missing?
Thanks Smile
------------------
BeatBox Entertainment
beat-box.com
Ron Newbigging



[This message has been edited by ron4315 (edited October 17, 1999).]
Quote Reply
Re: Links as Voting Topsites? In reply to
Sorry if you are confused, but there are no variations of the Mod. The Mod was written by Jerry.

Wink

Here is what you need to do for templates:

1) Add the following sub-routine in your nph-build.cgi file. This can be placed at the end of the script:

Code:
sub build_top_x {
my ($category) = @_;
my (@values, $top_cat, @topx, $topxhtml, $count);
$db_sort_links = "14";
@topx = &build_sorthit (@{$links{$category}});
$db_sort_links = "1";
$topxhtml = qq~<table cellpadding="0" cellspacing="0" border="0">\n~;
my $display = 5;
(($#topx+1) / ($#db_cols+1) >= 5) or $display = ($#topx+1)/($#db_cols+1);
for ($i = 0; $i < $display; $i++) {
%tmp = &array_to_hash ($i, @topx);
$count = $i+1;
$topxhtml .= qq~<tr><td valign="top"><$font><b>$count.</b></font> </td><td valign="top"><$font>~;
if ($tmp{'isDetailed'} eq "Yes") { $topxhtml .= qq~<a href="$build_detail_url/$tmp{$db_key}$build_extension"><b>$tmp{'Title'}</b></a>~; }
else { $topxhtml .= qq~<a href="$build_jump_url?$db_key=$tmp{$db_key}"><b>$tmp{'Title'}</b></a>~; }
$topxhtml .= qq~</font><br><$font_small>($tmp{'Hits'} Downloads)</font></td></tr>\n~;
}
$topxhtml .= qq~</table>~;
return $topxhtml;
}

2) Then add the following codes:

Code:
$top = &build_top_x ($cat);

AFTER the following codes in the sub build_category_pages routine in the nph-build.cgi file:

Code:
$title_linked = &build_linked_title ($cat);
$title = &build_unlinked_title ($cat);
$total = ($#{$links{$cat}} + 1) / ($#db_cols + 1);
$category_name = $cat;
$category_name_escaped = &urlencode ($cat);
$category_clean = &build_clean ($cat);

3) Add the following codes:

Code:
$t1 = time();
print "** Creating Top Sites in Categories. . .\n";
&build_top_x;
print "** Done (", time - $t1, " s)!\n\n";

AFTER the following codes:

Code:
$t1 = time();
print "** Creating What's Cool Page. . .\n";
&build_rate_page;
print "** Done (", time - $t1, " s)!\n\n";

in the sub build_staggered routine in the nph-build.cgi file.

4) Add the following codes:

Code:
# Create Top Sites in Categories
print "Building Top Sites in Categories . . .\n";
&build_top_x;
print "Done\n\n";

AFTER the following codes in the sub build_all routine in nph-build.cgi:

Code:
# Create What's Cool Page
$use_html ?
print "Building <A HREF=\"$build_ratings_url/$build_index\">What's Cool</A> Page . . .\n" :
print "Building Top Rated . . .\n";
&build_rate_page;
print "Done\n\n";

5) Add the following codes to the sub site_html_category routine in the %load_template area:

Code:
top => $top,

6) Then in your category.html template file, add the following tag to the spot in the page where you want the Top Sites located:

Code:
<%top%>

Hope this makes it clear.

Smile

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited October 17, 1999).]
Quote Reply
Re: Links as Voting Topsites? In reply to
ok.. for templates..

add this subroutine to the end of nph-build.cgi

Code:
sub build_top_x {
my ($category) = @_;
my (@values, $top_cat, @topx, $topxhtml, $count);
$original = $db_sort_links;
$db_sort_links = $db_hits;
@topx = &build_sorthit (@{$links{$category}});
$db_sort_links = $original;
$topxhtml = qq~<table cellpadding="0" cellspacing="0" border="0">\n~;
my $display = 5;
(($#topx+1) / ($#db_cols+1) >= $display) or $display = ($#topx+1)/($#db_cols+1);
for ($i = 0; $i < $display; $i++) {
%tmp = &array_to_hash ($i, @topx);
$count = $i+1;
$topxhtml .= qq~<tr><td valign="top"><$font><b>$count.</b></font> </td><td valign="top"><$font>~;
if ($tmp{'isDetailed'} eq "Yes") { $topxhtml .= qq~<a href="$build_detail_url/$tmp{$db_key}$build_extension"><b>$tmp{'Title'}</b></a>~; }
else { $topxhtml .= qq~<a href="$build_jump_url?$db_key=$tmp{$db_key}"><b>$tmp{'Title'}</b></a>~; }
$topxhtml .= qq~</font><br><$font_small>($tmp{'Hits'} Downloads)</font></td></tr>\n~;
}
$topxhtml .= qq~</table>~;
return $topxhtml;
}

then in build_category_pages (in nph-build.cgi)

below:

Code:
$category_clean = &build_clean ($cat);

add:

Code:
$topx = &build_top_x ($cat);

then in site_html_category (in site_html_templates.pl)

add this to the list of variables.. anywhere in it..

Code:
topx => $topx,

then in the html page add <%top%> and it should show up..

jerry

[This message has been edited by widgetz (edited October 17, 1999).]
Quote Reply
Re: Links as Voting Topsites? In reply to
aww.. eliot beat me Wink

jerry
Quote Reply
Re: Links as Voting Topsites? In reply to
eliot.. where did step 3 and 4 come in?

btw.. you should use the subroutine i posted in my instructions.. it automates the process of getting the IDs.. i just made that change a second ago..

jerry
Quote Reply
Re: Links as Voting Topsites? In reply to
All I did was add the steps of adding checks in the build all and build staggered process.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Links as Voting Topsites? In reply to
Wouldnt it be <%top%> instead of <%topx%> Widgetz?

------------------
BeatBox Entertainment
beat-box.com
Ron Newbigging



[This message has been edited by ron4315 (edited October 17, 1999).]
Quote Reply
Re: Links as Voting Topsites? In reply to
no.. i changed it to topx cause i think top is too common..

jerry
Quote Reply
Re: Links as Voting Topsites? In reply to
eliot..

http://www.gossamer-threads.com/...um3/HTML/003405.html

(just something i thought you could use.. after going to your site.. i beleive you are doing those yahoo style links by hand? [the new one does it in the order you want it to be in..] i just wanted you to try it)

also.. why did you need step 3 and 4.. they don't do anything.. it just goes through the subroutine and returns nothing..

jerry
Quote Reply
Re: Links as Voting Topsites? In reply to
Hi Widgetz,

One more thing, It worked thanks!

But I got a lot of empty brackets, " <> " and also, it doesnt seem to be ranking on anything in particular?!

How would I be able to make it rank on Rating?

------------------
BeatBox Entertainment
beat-box.com
Ron Newbigging

Quote Reply
Re: Links as Voting Topsites? In reply to
ok.. now i'm such a retard..

i changed:

Code:
$db_sort_links = $db_def{$db_cols[$db_hits]}[0];

to

Code:
$db_sort_links = $db_hits;

just change $db_hits to $db_rating or whatever yours is..

jerry
Quote Reply
Re: Links as Voting Topsites? In reply to
ron4315,

You also need to change <$font> in the codes that Jerry wrote. This variable is defined in the non-templates version. But with templates, the font style does not show. You need to manually add in the font anchors.

Smile

Jerry,

The only reason I put Step 3 and 4 was so that I can check to see if that process has been completed. Also, I am not using Yahoo's bolded tags. But I will give that Mod a shot.

Wink

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Links as Voting Topsites? In reply to
Hi widgetz,

i use your mod and everything works fine, but the "ranking" is in wrong order.
There is no System in it, like the one with the most hits on top.

Also most of the entrys in the category are not shown.

As example:

1. Some Link (9 Hits)
2. Some Link (320 Hits)
3. Some Link (1 Hits)
4. Some Link (1 Hits)
5. Some Link (1 Hits)

But there are also entrys with 123 or 212 Hits, but there are not in the toplist.

Do you have an solution?

Karl


[This message has been edited by Karl (edited October 18, 1999).]
Quote Reply
Re: Links as Voting Topsites? In reply to
Yea...In Jerry's earlier post, he mentioned that you need to edit the sub build_sorthit routine in the db_utils.pl file.

Go to the following URL for information on what you need to edit the sub build sorthit routine:

http://www.widgetz.com/...w/instructions.cgi?4

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Links as Voting Topsites? In reply to
Hi,

I dont understand what you meant by replacing that line with "$db_sort_links = $db_hits;" ?

What script is that line suppose to be in? This will fix the sorting routine right to rate from most hits to leasT?

------------------
BeatBox Entertainment
beat-box.com
Ron Newbigging

Quote Reply
Re: Links as Voting Topsites? In reply to
Oops,
One more thing...

How can this be incorporated in utilizing the link.html template as well?



------------------
BeatBox Entertainment
beat-box.com
Ron Newbigging

Quote Reply
Re: Links as Voting Topsites? In reply to
ron4315,

To make the links list from most to least hits, you have to replace the sub build_sorthit routine that Jerry wrote in the following URL:
http://www.widgetz.com/...w/instructions.cgi?4

with the sub build_sorthit that you have in your db_utils.pl file. Does this make sense?

Also, to use the link.html format in this Mod, I believe that what you do is replace the following codes:

Code:
$topxhtml .= qq~<a href="$build_detail_url/$tmp{$db_key}$build_extension"><b>$tmp{'Title'}</b></a>~;

AND

Code:
$topxhtml .= qq~<a href="$build_jump_url?$db_key=$tmp{$db_key}"><b>$tmp{'Title'}</b></a>~;

Code:
$topxhtml .= &site_html_link (%tmp);

However, by doing this you will lose the different links to the detailed and jump.cgi.

But this should work.

Hope this helps.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited October 18, 1999).]
Quote Reply
Re: Links as Voting Topsites? In reply to
Bookmarking this one to dive into when I have more time, but was wondering....does this output the "topsites" list on every page of the category?
Quote Reply
Re: Links as Voting Topsites? In reply to
Hi Brad,

yes, take a look at http://www.kostnixx.de

Karl

[This message has been edited by Karl (edited October 20, 1999).]
Quote Reply
Re: Links as Voting Topsites? In reply to
Well, the initial post in this thread mentioned about a "top sites voting" mod.

But what you have acheived is a listing of sites based on "hits" and not "votes".

Is it possible to make a voting mod to list top sites in each category? That would be cool.

Thanks
Quote Reply
Re: Links as Voting Topsites? In reply to
uhh??

i didn't understand what you meant by a voting mod..

anything is possible.. just be more specific and when i find time i'll do it..

jerry
Quote Reply
Re: Links as Voting Topsites? In reply to
 
Quote:
anything is possible..
Hmmm... are they still teaching that in schools?

OK, what I mean is using it as a voting script, ranking sites based on votes(ratings, 9.5, 8.3, 7.5.... with 9.5, the site with highest ranking at the top) cast by users. I think it is a bit complicated as you have to count and average votes for all sites within a category.

What we have above is an arragement of sites based on "hits" to those sites.

I saw a site once, I can't remember the url. They ranked sites in each category, based on user ratings. Sort of like a topsites script but with a number of categories and subcategories.
Quote Reply
Re: Links as Voting Topsites? In reply to
i still don't get it..

let's see.. what i get out of all that is..

SORT BY VOTES then RATINGS?

if so.. then you'd do the same as the hits script except sort it twice.. first by ratings then by votes

change:
Code:
$original = $db_sort_links;
$db_sort_links = $db_hits;
@topx = &build_sorthit (@{$links{$category}});
$db_sort_links = $original;

to

Code:
$original = $db_sort_links;
$db_sort_links = $db_rating;
@topx = &build_sorthit (@{$links{$category}});
$db_sort_links = $db_votes;
@topx = &build_sorthit (@topx);
$db_sort_links = $original;
Quote Reply
Re: Links as Voting Topsites? In reply to
Hi Widgetz,

What about sorting the list based on average votes per day?

Also, can something be implemented to let a person be able to vote only ONCE per day?

Thanks a lot! Smile

------------------
BeatBox Entertainment
beat-box.com
Ron Newbigging

Quote Reply
Re: Links as Voting Topsites? In reply to
using alex's rate.cgi you'd only be able to do it everytime you build.. if you built it once a day.. then it would sorta be like only allowing them to rate once a day Wink

if you use review.cgi's rate.. then you can.. but it would call for some extra code..

where it checks for the ip.. you can add like

&& $rec{'Date'} eq $date

something like that..

as for votes per day.. you can do this by hmm.. interesting..

you'd have to come up with a whole nother build_sorthit..

one that used this:

$values[$db_votes]/&days_old($values[$db_modified])

you can rewrite build_sorthit into like sort_votesperday

and then hardcode it.. tell me if you still want to.. otherwise the easiest way is to make another field with the info in it.. (would actually be faster for links to process)..

jerry
Quote Reply
Re: Links as Voting Topsites? In reply to
Hi Jerry,

Take a look at this site. http://www.toptenlinks.com

This is what I mean. Like you have categories and the list is arranged based on the ratings cast by visitors.
Quote Reply
Re: Links as Voting Topsites? In reply to
of course....

that is simple actually.. you sort it by ratings..

and then it's pretty much done.. the form for the voting is just html and i think you'd get that yourself..

when you sort it by rating.. the rank is already done for you.. $i+1

anyways..

jerry
Quote Reply
Re: Links as Voting Topsites? In reply to
I have changed all the codes like eliot and you have said.
but when I click on a pages it say:
Unkown Tag: top

how do I fix this? please help
also I changed the top ranking from the # of hits to # of votes
Quote Reply
Re: Links as Voting Topsites? In reply to
You have forgotten to make top a tag in the load template area of sub site_html_category routine in the site_html_templates.pl as my instructions clearly state. Make sure that you have used either top or topx in your nph-build.cgi file. For whatever variable you used, you must identify this tag in the routine I mentioned, like the following:

Code:
top => $top,

OR

Code:
topx => $topx,

Hope this helps.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Links as Voting Topsites? In reply to
Ok now this is messed up
now IM getting this:
CGI ERROR
==========================================
Error Message : fatal error: Undefined subroutine &main::site_html_print_cat called at /vhome1/jolo/cgi-bin/admin/site_html_templates.pl line 944.

Script Location : nph-build.cgi
Perl Version : 5.00503

im getting this after links trys to build a page
Please help

Quote Reply
Re: Links as Voting Topsites? In reply to
Save the following files as text files:

1) nph-build.cgi => nph-build.txt
2) site_html_templates.pl => site_html.templates.txt
3) category.html => category.txt

and upload the text files to a publicly accessibly web directory, AND provide the URL to these files.

WE need to see your files to help you.

BTW: It is best to make current backup of files you are hacking. Smile

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------




[This message has been edited by Eliot (edited November 09, 1999).]
Quote Reply
Re: Links as Voting Topsites? In reply to
Thanks alot:
http://www.worldvoter.com/category.txt
http://www.worldvoter.com/nph-build.txt
http://www.worldvoter.com/site_html_templates.txt

I think this is the screwy one:
http://www.worldvoter.com/site_html_templates.txt

There might be more than one thing messedup.
thanks again !
Quote Reply
Re: Links as Voting Topsites? In reply to
Your site_html_templates.pl text version is NOT FOUND at the URL you gave, so we can't help you.

Please re-post the correct URL!

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Links as Voting Topsites? In reply to
http://www.worldvoter.com/site_html_templates.txt

ok its there
thanks again my man
Quote Reply
Re: Links as Voting Topsites? In reply to
hey dude, wierd but your site_html_templates.pl, resembles nph-build.cgi somewhat.
Quote Reply
Re: Links as Voting Topsites? In reply to
Thank you every body
This mod was great
I turned it inot a voting booth
and I love it
thank you
guys
Quote Reply
Re: Links as Voting Topsites? In reply to
So, you have it working, right?

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Links as Voting Topsites? In reply to
hehe.. that was ... weird Smile

i think he probably went through the instructions and figured out that he did soemthign wrong..

eliot.. have you gotten the grep search to work.. i have gotten it to work at hexapods.com

the URL for reg search is..

http://www.hexapods.com/...earch.cgi?query=test

and URL for GREP search is..

http://www.hexapods.com/...-grep.cgi?query=test

it's using the latest code which saves memory.. (which takes less load on server.. speed is the same.. just too fast Smile)

highlight the VERY bottom to see how long grep takes.. (not in search.cgi)

jerry

[This message has been edited by widgetz (edited November 11, 1999).]
Quote Reply
Re: Links as Voting Topsites? In reply to
Ok one other thing, I want this mod incorporated in the actual links section,
so all the sites are on the list.
for example on:
http://worldvoter.com/adult/
I want to get rid of the Links: section
and have top sites: list all the sites in that category with the standard link format, description,and (Added: 12-Nov-1999 Hits: 65 Rating: 9 Votes: 23)

please help
much appreciated
Quote Reply
Re: Links as Voting Topsites? In reply to
Very cool widgetz, looks good, took 3 on the regular and 1 on the grep one.
Quote Reply
Re: Links as Voting Topsites? In reply to
I need and dont know how to accutally incorporate this mod in the actual links section, so all the sites are on the top list in that category.
for example on:
http://worldvoter.com/adult/
I want to get rid of the (Links in this category Smile section and have (top sites Smile list all the sites (not just 5) in that category with the standard link format, description,and (Added: 12-Nov-1999 Hits: 65 Rating: 9 Votes: 23)

anybody
please help
Quote Reply
Re: Links as Voting Topsites? In reply to
Hi Jerry,
Ever since I've been using links2 I have been using this thread of yours and
perfecting this mod.
http://www.gossamer-threads.com/scripts/forum/resources/Forum3/HTML/003566.html

When I add top => $top, into the
sub site_html_category routine in the
site_html_templates.pl file
Every time you click next 25 at the bottom of this category
http://www.worldvoter.com/business/adult/
, it brings up the top 25 again, but theres 30 links in that category.
What can I do to make the
next 25 link work!!!
please help
thanks
Johnathan
worldvoter.com


Quote Reply
Re: Links as Voting Topsites? In reply to
Hi

I have installed this mod, but it doesn't seem to generate a top five in each category. The tag is recognised in the template and I don't get any errors.

I have followed widgetz instructions carefully.

This is the appropriate section of my nph_build

sub build_top_x {
my ($category) = @_;
my (@values, $top_cat, @topx, $topxhtml, $count);
$original = $db_sort_links;
$db_sort_links = $db_rating;
@topx = &build_sorthit (@{$links{$category}});
$db_sort_links = $original;
$topxhtml = qq~<table cellpadding="0" cellspacing="0" border="0">\n~;
my $display = 5;
(($#topx+1) / ($#db_cols+1) >= $display) or $display = ($#topx+1)/($#db_cols+1);
for ($i = 0; $i < $display; $i++) {
%tmp = &array_to_hash ($i, @topx);
$count = $i+1;
$topxhtml .= qq~<tr><td valign="top"><$font><b>$count.</b></font> </td><td valign="top"><$font>~;
if ($tmp{'isDetailed'} eq "Yes") { $topxhtml .= qq~<a href="$build_detail_url/$tmp{$db_key}$build_extension"><b>$tmp{'Title'}</b></a>~; }
else { $topxhtml .= qq~<a href="$build_jump_url?$db_key=$tmp{$db_key}"><b>$tmp{'Title'}</b></a>~; }
$topxhtml .= qq~</font><br><$font_small>($tmp{'Hits'} Downloads)</font></td></tr>\n~;
}
$topxhtml .= qq~</table>~;
return $topxhtml;
}

my dbutils file has the following section in it

sub build_sorthit {
# --------------------------------------------------------
# This function sorts a list of links. It has been modified to sort
# new links first, then cool links, then the rest alphabetically. By modifying
# the sort function below, you can sort the links however you like (by date,
# or random, etc.).

my (@unsorted) = @_;
my ($num) = ($#unsorted+1) / ($#db_cols+1);
my (%sortby, %isnew, %iscool, $hit, $i, @sorted, $column, $type);

foreach $column (@db_cols) {
if ($db_sort_links == $db_def{$column}[0]) {
$type = $db_def{$column}[1];
last;
}
}
for ($i = 0; $i < $num; $i++) {
$sortby{$i} = $unsorted[$db_sort_links + ($i * ($#db_cols+1))];
($unsorted[$db_isnew + ($i * ($#db_cols+1))] eq "Yes") and ($isnew{$i} = 1);
($unsorted[$db_ratings + ($i * ($#db_cols+1))] eq "Yes") and ($iscool{$i} = 1);
}
if ($type eq "date") {
foreach $hit (sort {

&date_to_unix ($sortby{$b}) <=> &date_to_unix ($sortby{$a});
} (keys %sortby)) {
$first = ($hit * $#db_cols) + $hit;
$last = ($hit * $#db_cols) + $#db_cols + $hit;
push (@sorted, @unsorted[$first .. $last]);
}
}
elsif ($type eq "numer") {
foreach $hit (sort {
$sortby{$b} <=> $sortby{$a};
} (keys %sortby)) {
$first = ($hit * $#db_cols) + $hit;
$last = ($hit * $#db_cols) + $#db_cols + $hit;
push (@sorted, @unsorted[$first .. $last]);
}
}
else {
foreach $hit (sort {
($isnew{$b} and !$isnew{$a}) and return 1;
($isnew{$a} and !$isnew{$b}) and return -1;
($iscool{$b} and !$iscool{$a}) and return 1;
($iscool{$a} and !$iscool{$b}) and return -1;
($isnew{$a} and $isnew{$b}) and return lc($sortby{$a}) cmp lc($sortby{$b});
($iscool{$a} and $iscool{$b}) and return lc($sortby{$a}) cmp lc($sortby{$b});
return lc($sortby{$a}) cmp lc($sortby{$b});
} (keys %sortby)) {
$first = ($hit * $#db_cols) + $hit;
$last = ($hit * $#db_cols) + $#db_cols + $hit;
push (@sorted, @unsorted[$first .. $last]);
}
}
return @sorted;
}

sub urlencode {
# --------------------------------------------------------
# Escapes a string to make it suitable for printing as a URL.
#
my($toencode) = shift;
$toencode =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
$toencode =~ s/\%2F/\//g;
return $toencode;
}

Also I am using widgetz review mod.

I currently don't have that many reviews, is there a minimum number required hidden somewhere in this code?


Any ideas what I am missing?

Thanks

Rob





Quote Reply
Re: Links as Voting Topsites? In reply to
Rob,

I have answered your Topic.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: Links as Voting Topsites? In reply to
I've been using a similar mod for the same top x effect written by ladyofdragons at:

http://www.gossamer-threads.com/scripts/forum/resources/Forum3/HTML/003858.html

This works great for me except webmasters can keep clicking their links to cheat and increase their ranking. Eliot, you mention using $tmp{'URL'} in jump.cgi to get around this problem. Could you explain how this works and what it does so I can implement in the similar mod I referenced?

Thanks, Ryan

Quote Reply
Re: Links as Voting Topsites? In reply to
NOT in the jump.cgi script, but in the codes provided in this Topic.

Read the postings more carefully.

Good luck!

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: Links as Voting Topsites? In reply to
Thanks, but regardless could you please explain what that does? Actually I couldn't even find the $tmp{'URL'} in any of the code.
Quote Reply
Re: Links as Voting Topsites? In reply to
Duh...look at the codes Widgetz has provided...Look for the $tmp{'fieldname'} codes...

Look at Widgetz's posting on

posted 10-16-99 11:56 PM PST

Replace jump.cgi?ID=$tmp{'db_key'} with $tmp{'URL'}.

I REALLY hope this helps.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: Links as Voting Topsites? In reply to
Hi guys,

Sorry to have to bring this up again. I have followed Eliot's instruction and managed to successfully display the top 5 links in each category. However, I would like to go one step further - is it possible to only display the top 5 links in the main categories and not the subcategories, allowing links that reside in the subsequent subcategories to be displayed in these aswel?

I hope I have explained myself clearly enough!

Cheers.

Quote Reply
Re: Links as Voting Topsites? In reply to
I did everything as explained and when I add
<%top%> on my category.html template it doesn't print anything.
When I build the pages (admin area) it says:

Building Top Sites in Categories . . .
Done

but...

BTW: this url:
http://www.widgetz.com/review/instructions.cgi?4
no longer exist.

What do I have to do in order to have my top list per category printed on the matching page?

Thanks