[dokuwiki] Re: Testing for existence of a page

  • From: Chris Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Thu, 31 May 2007 12:50:36 +0100

Ferdinand Soethe wrote:
I'm deriving an extended TOC-Plugin for arctic from Ginas code and I'm
stuck with the simple task of testing for the existence of a page.

I found

search_pagename(&$data,$base,$file,$type,$lvl,$opts)

but no examples of how to use it.
What params do I need to test if a page bla:blobb exists?

Any hints or examples much appreciated.

Best regards,
Ferdinand Soethe

Do you need search?

The answer to your question as asked - how to test for the existence of a page - is:

best: resolve_pageid();
simple: file_exists(wikiFN());

both functions are part of inc/pageutils.php. You'll need to check there for details of parameters, return values, etc.

For details of the search call back functions (e.g. search_pagename) read the comments at the top of the file (inc/search.php).

- Chris

--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: