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

ABClf languefrancaise at gmail.com
Sun Feb 9 17:05:38 PST 2020

Hello hello,

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 ;)
Thanks a lot.

More information about the pmwiki-users mailing list