[pmwiki-users] Check for existence of page?

Peter Bowers pbowers at pobox.com
Fri Apr 16 20:45:39 CDT 2010


On Fri, Apr 16, 2010 at 6:01 PM, Mark Bacas <mbacas at gmail.com> wrote:
> Maybe there is another way to do what I want. I want to display some helpful
> information on the homepage until the person creates a new entry which is
> done via powertools newticket, so I know if they do it this century the page
> will start with 2.

This code:

$Conditions['existswc'] = "(boolean)ListPages(FixGlob(\$condparm, '$1*.$2'))";

in your config.php (or elsewhere appropriate) will give you a new
conditional operator analogous to "exists" except it will accept
wildcards.

I've tested it against matching 0 times, 1 time, and multiple times
against simple alphabetic names with or without the group name
specified -- there's probably other things that should be checked...
If you find problems or special cases where it doesn't work please let
me know or document them on
http://www.pmwiki.org/wiki/Cookbook/ConditionalMarkupSamples#existswc

If indeed it works consistently after more thorough testing then it
may be a good PITS entry to replace the current "exists" condition
with this one...

-Peter



More information about the pmwiki-users mailing list