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 3359 Feb 7, 2001, 6:49 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
sportscapper 3271 Feb 10, 2001, 2:16 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
Stealth 3280 Feb 10, 2001, 2:37 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
sportscapper 3249 Feb 10, 2001, 7:49 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
glennu 3232 Feb 10, 2001, 8:14 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
sportscapper 3227 Feb 10, 2001, 10:04 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
glennu 3231 Feb 11, 2001, 7:43 AM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
sportscapper 3223 Feb 11, 2001, 1:17 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
glennu 3229 Feb 11, 2001, 1:47 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
sportscapper 3189 Feb 11, 2001, 5:16 PM
Thread Re: Ordering the Links RECIP, COOL, NEW, ALPHA
humorlinks 3175 Feb 11, 2001, 7:57 PM
Post Re: Ordering the Links RECIP, COOL, NEW, ALPHA
sportscapper 3184 Feb 11, 2001, 8:28 PM