[pmwiki-users] Check for existence of page?

Hans design5 at softflow.co.uk
Fri Apr 16 17:47:31 CDT 2010


Friday, April 16, 2010, 11:01:14 PM, Mark Bacas 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.

perhaps like this:

(:if equal {(pagelist group=MTD name=2010* fmt=count)} 0:)
No page created this year yet....
(:ifend:)

or its reverse:
(:if ! equal {(pagelist group=MTD name=2010* fmt=count)} 0:)
Some pages created this year already....
(:ifend:)

This uses powertools {(pagelist)} markup expression, which allows for
all the pagelist parameters. fmt=count gets the count of the matching
pages, which we can use for a logical comparison.

See also http://www.pmwiki.org/wiki/Cookbook/ConditionalExtensions
for 'greater than' and 'lesser than' conditional comparisons.

But be aware that pages load slower the more pagelist calls are made.
Still, fmt=count should not add that much to page render time, since
it does not involve formatting.


  ~Hans




More information about the pmwiki-users mailing list