[pmwiki-users] PageList sort order (numerical values)

Petko Yotov 5ko at 5ko.fr
Sun Apr 5 01:44:23 CDT 2015


On 2015-04-05 07:59, ABClf wrote:
> Warning: Illegal string offset 'targets' in
> /homepages/18/d269604285/htdocs/dev6/scripts/pagelist.php(476) :
> runtime-created function on line 1

Indeed, this should be more like:

   function NbSource($targets) {
     return substr_count($targets, "PmWiki.");
   }

   # permute $x and $y to have it sort the other way
   $PageListSortCmp['nbsource'] =
   'NbSource(@$PCache[$x]["targets"]) - 
NbSource(@$PCache[$y]["targets"])';

   # if you need {$NbSource} in wiki pages
   $FmtPV['$NbSource'] = 'NbSource($page["targets"])';

Petko




More information about the pmwiki-users mailing list