Gossamer Forum
Home : Products : Links 2.0 : Customization :

Links as Voting Topsites?

(Page 3 of 3)
> >
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


> >