Gossamer Forum
Home : Products : Links 2.0 : Customization :

Ordering the Links RECIP, COOL, NEW, ALPHA

Quote Reply
Ordering the Links RECIP, COOL, NEW, ALPHA
I recenlty installed the Reiprical link MOD sucessfully, but I was not able to give priority to the Recip links, I followed everything in the threads and resource center, but I still get the same problem, the new links always appear firstm then cool, then recip

Here is my code, maybe someone could tell me what is wrong with 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, %isrecip, %isnew, %iscool, $hit, $i, @sorted);
for ($i = 0; $i < $num; $i++) {
$sortby{$i} = $unsorted[$db_sort_links + ($i * ($#db_cols+1))];
($unsorted[$db_isrecip + ($i * ($#db_cols+1))] eq "Yes") and ($isrecip{$i} = 1);
($unsorted[$db_isnew + ($i * ($#db_cols+1))] eq "Yes") and ($isnew{$i} = 1);
($unsorted[$db_ispop + ($i * ($#db_cols+1))] eq "Yes") and ($iscool{$i} = 1);
}
foreach $hit (sort {
($isrecip{$b} and !$isrecip{$a}) and return 1;
($isrecip{$a} and !$isrecip{$b}) and return -1;
($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;
($isrecip{$a} and $isrecip{$b}) and return lc($sortby {$a}) cmp lc($sortby{$b});
($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;
}


Subject Author Views Date
Thread Ordering the Links RECIP, COOL, NEW, ALPHA sportscapper 2440 Feb 7, 2001, 6:49 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
sportscapper 2370 Feb 10, 2001, 2:16 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
Stealth 2382 Feb 10, 2001, 2:37 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
sportscapper 2351 Feb 10, 2001, 7:49 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
glennu 2333 Feb 10, 2001, 8:14 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
sportscapper 2327 Feb 10, 2001, 10:04 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
glennu 2325 Feb 11, 2001, 7:43 AM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
sportscapper 2324 Feb 11, 2001, 1:17 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
glennu 2331 Feb 11, 2001, 1:47 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
sportscapper 2291 Feb 11, 2001, 5:16 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
humorlinks 2277 Feb 11, 2001, 7:57 PM
Post Re: Ordering the Links RECIP, COOL, NEW, ALPHA
sportscapper 2287 Feb 11, 2001, 8:28 PM