[pmwiki-users] Strange issue with PageListSortCmp

ABClf languefrancaise at gmail.com
Mon Aug 31 03:07:19 CDT 2015

I'm playing with data, and I'm facing a strange issue with PageListSortCmp :

I want to pagelist in Words group (named : Bob), extract numerical ptv
(named : registre_origine, which value, when not empty, is set from 1
to 10) and order the result from 1 to 10, or 10 to 1.

Fort the special sorting, in my config :

# sorting pages by numerical integer pagetextvar data
function IntegerDataCompare($x, $y, $var) {
      # get integer value of the page text variable
      $xval = intval(PageTextVar($x, $var));
      $yval = intval(PageTextVar($y, $var));
      # compare integer values
      if($xval > $yval) $c = 1;
      elseif($xval < $yval) $c = -1;
      else $c = 0;
      return $c;

$PageListSortCmp['registre_origine'] = 'IntegerDataCompare($x, $y,

My pagelist :

(:pagelist group=Bob link=Source.2048  $:registre_origine=-
fmt=#registre order=registre_origine:)

Strangely, it's half working, half broken : data are ordered, but it
looks like the list is splitted : I get something like this, (where x
appears as if it were empty) : 10 10 10 9 9 8 8 7 7 6 6 5 5 4 4 3 x 10
10 9 9 (etc., list continues, broken several times by an empty value).


When I edit the page stocking the broken data (in my example, it would
be the page stocking the x (empty) value, I don't see the problem, the
ptv registre_origine is not empty and has a regular value).

I note that the same pagelist, with no order param, has no issue
(:pagelist group=Bob link=Source.2048  $:registre_origine=- fmt=#registre:)

That is not a huge pagelist yet it's a quite big one. Might it be the issue ?
(:pagelist group=Bob link=Source.2048  $:registre_origine=-
fmt=count:) gives me : 1332
(:pagelist group=Bob link=Source.2048  fmt=count:) gives me 2817.

Thank you,

More information about the pmwiki-users mailing list