Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Re: [johnnyic] Sorting a database

Quote Reply
Re: [johnnyic] Sorting a database In reply to
>>
How can I make a change so that the latest entry show at the top of the list, for example today's date goes on top, yesterday underneath, acsending as opposed to desending
<<

It should already do it by default. New links go to the top.

You'll need to look at sub build_sorthit in db_utils.pl

Code:
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});
}
Subject Author Views Date
Thread Sorting a database johnnyic 3958 Feb 20, 2002, 4:27 AM
Thread Re: [johnnyic] Sorting a database
Andy 3921 Feb 20, 2002, 5:54 AM
Thread Re: [AndyNewby] Sorting a database
Paul 3905 Feb 20, 2002, 6:09 AM
Thread Re: [RedRum] Sorting a database
Andy 3908 Feb 20, 2002, 6:17 AM
Post Re: [AndyNewby] Sorting a database
Paul 3890 Feb 20, 2002, 6:27 AM
Thread Re: [johnnyic] Sorting a database
Paul 3877 Feb 20, 2002, 6:29 AM
Post Re: [RedRum] Sorting a database
johnnyic 3831 Feb 24, 2002, 7:44 AM