[pmwiki-users] pagelist order

Hans design5 at softflow.co.uk
Thu Mar 20 19:03:01 CDT 2008


you can also write it more compac:

$PageListSortCmp['shortyear'] = 'ShortYear($x, $y)';
function ShortYear($x, $y) {
        $a = array();
        foreach(array($x,$y) as $p) {
                $d = PageVar($p, '$Name');
                $y = substr($d,0,2);
                $n = substr($d,2);
                if ($y>=50) $a[] = '0'.$y.','.$n;
                else $a[] = '1'.$y.','.$n;
        }
        return strcmp($a[0], $a[1]);
}

  ~Hans




More information about the pmwiki-users mailing list