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

ABClf languefrancaise at gmail.com
Sat Apr 4 04:05:56 CDT 2015


I am willing to get pagelist results sorted by popularity : i.e. count
backlinks (targets). That way, most linked pages will be shown first.

For counting, targets, in config, I have :

# NbSource
$FmtPV['$NbSource'] = 'NbSource($page["targets"])';
function NbSource($targets) {
  $cnt = substr_count($targets, "Source.");
  return $cnt>0? "$cnt" : '';

(copied from http://www.pmwiki.org/wiki/Cookbook/MoreCustomPageVariables)

And my pagelist is like that :

(:pagelist group=Bob link={*$FullName} fmt=#description2 order=$NbSource:)

Problem now, is how to make value 2 before value 11, and so on (natural

I have this line in my config as well, yet I dont know how to use it :
$PageListSortCmp['natural'] = 'strnatcasecmp($x, $y)';

Thank you,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20150404/7ca05b42/attachment.html>

More information about the pmwiki-users mailing list