[Pmwiki-users] Overwriting page

Patrick R. Michaud pmichaud
Wed Jul 7 18:44:29 CDT 2004


On Tue, Jul 06, 2004 at 08:18:21AM -0500, Philip Mateescu wrote:
> I would like to implement a feature in my installation of pmwiki where a 
> page (or some parts of it) would be overwritten when its name matches a 
> certain RegExp. The page may or may not exist. What is the simplest way 
> of doing this?

You probably want to intercept the post or edit action in your config.php,
something along the lines of

    if ($action=='edit' && preg_match('/some regexp/',$pagename) {
      ...
    }

I probably need a slightly more detailed example of what you want
to happen before I can give better pointers beyond this.

> Also, if I would like to get the content of a page X.Y, from code, what 
> do I need to call in order to get that?

The code

   $page = ReadPage('X.Y');

reads the contents of X.Y into the array $page.  $page['text'] then
contains the page's current text.  Note that as a side effect ReadPage() 
also does Lock(1), which prevents any other PmWiki process from writing 
a page until the current script has exited or executed Lock(0).

Pm



More information about the pmwiki-users mailing list