[pmwiki-users] Pagelist ordering by name

Peter Bowers pbowers at pobox.com
Tue Oct 13 02:19:29 CDT 2009


On Tue, Oct 13, 2009 at 9:11 AM, Peter Bowers <pbowers at pobox.com> wrote:
> Better solution to each:
>
> SORTING WITHOUT A/AN/THE:
>
> $FmtPV['$TitleNoArticle'] = 'preg_replace("/^ *(?:The|An?) /i", "",
> (@$page["title"] ?  : $AsSpacedFunction($name)), 1)';
>
> (:pagelist ... order=$TitleNoArticle ...:)

Sorry - I just noticed I had used the new capabilities in 5.3 to avoid
expr2 with the ternary operator (expr1 ? expr2 : expr3).  If you want
this to work in any version prior to PHP 5.3 you will need to put in
the $page["title"] again like this:

> $FmtPV['$TitleNoArticle'] = 'preg_replace("/^ *(?:The|An?) /i", "",
> (@$page["title"] ?  $page["title"] : $AsSpacedFunction($name)), 1)';

-Peter



More information about the pmwiki-users mailing list