[pmwiki-users] Pagelist ordering by name
Peter Bowers
pbowers at pobox.com
Mon Oct 12 14:31:30 CDT 2009
On Mon, Oct 12, 2009 at 11:53 AM, Simon <nzskiwi at gmail.com> wrote:
> I've been wanting to do something similar,
> with the added proviso that if the first wiki work is one of A, An, The then
> that should be ignored in the sort.
Here's a rough idea, depending on the {$Title} for your sorting, but
getting rid of A, An, & The:
$article_pat = '/^(?:The|An?) /i';
SDV($PageListSortCmp['title_no_article'],
'@strcasecmp(preg_replace(\''.$article_pat.'\', \'\',
$PCache[$x][\'=title\']), preg_replace(\''.$article_pat.'\', \'\',
$PCache[$y][\'=title\']))');
The quoting is pretty messy and could be cleaned up, but it seems to
work in my (albeit brief) testing.
-Peter
More information about the pmwiki-users
mailing list