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 2430 Feb 7, 2001, 6:49 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
sportscapper 2361 Feb 10, 2001, 2:16 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
Stealth 2373 Feb 10, 2001, 2:37 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
sportscapper 2342 Feb 10, 2001, 7:49 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
glennu 2324 Feb 10, 2001, 8:14 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
sportscapper 2318 Feb 10, 2001, 10:04 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
glennu 2316 Feb 11, 2001, 7:43 AM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
sportscapper 2315 Feb 11, 2001, 1:17 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
glennu 2322 Feb 11, 2001, 1:47 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
sportscapper 2282 Feb 11, 2001, 5:16 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
humorlinks 2268 Feb 11, 2001, 7:57 PM
Post Re: Ordering the Links RECIP, COOL, NEW, ALPHA
sportscapper 2278 Feb 11, 2001, 8:28 PM