Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Random links and new/pop at the top.

Quote Reply
Random links and new/pop at the top.
Hi

I've installed this script to have random links appear everytime I do build:

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

for ($i = 0; $i < $num; $i++) {
$sortby{$i} = $unsorted[$db_sort_links + ($i * ($#db_cols+1))];
if ($unsorted[$db_isnew + ($i * ($#db_cols+1))] eq "Yes") { $isnew{$i} = 1; }
if ($unsorted[$db_ispop + ($i * ($#db_cols+1))] eq "Yes") { $iscool{$i} = 1; }
}
srand;
foreach $hit (sort { return int(rand(1) + 0.5) ? 1 : -1 } (keys %sortby)) {

$first = ($hit * $#db_cols) + $hit;
$last = ($hit * $#db_cols) + $#db_cols + $hit;
push (@sorted, @unsorted[$first .. $last]);
}
return @sorted;
}
----------------------
END!


I've heard that by default it should put pop/new links to the top of the page, and after all ther other random links.
I set isPopular to Yes for the link I need to be at the top, then press build but I still have ALL links put in there randomly.

What am I doing wrong?

Thanks,
Art.
Quote Reply
Re: [dij] Random links and new/pop at the top. In reply to
any help would be really appreciated !



Art