[pmwiki-users] Sorting function (natural order) not working anymore (php72)

Petko Yotov 5ko at 5ko.fr
Tue Feb 11 14:23:34 PST 2020


On 10/02/2020 02:05, ABClf wrote:
> Still working on updating my config for php72.
> I used to have a code implemented in config to sort numerical PV
> (named RevCount) in natural ordre. I use it to list most/less edited
> pages (and want to have 9 revisions come before 10 revisions). It does
> not work anymore if I'm not mistaken.
> 
> Here it is the original code (from Petko) :
> 
> # sorting with revcount param (natural order 12>2)
> function IntegerNameCompare($x, $y) {
>       # get integer value of the page name or title
>       $xval = intval(PageVar($x, '$RevCount'));
>       $yval = intval(PageVar($y, '$RevCount'));
>       # compare integer values
>       if($xval > $yval) $c = 1;
>       elseif($xval < $yval) $c = -1;
>       else $c = 0;
>       return $c;
> }
> $PageListSortCmp['revcount'] = 'IntegerNameCompare($x, $y)';
> 
> I'm begging for help ;)

Try with removing "($x, $y)" like this:

   $PageListSortCmp['revcount'] = 'IntegerNameCompare';


Petko



More information about the pmwiki-users mailing list