[pmwiki-users] Page creation

Patrick R. Michaud pmichaud at pobox.com
Tue Oct 10 15:12:24 CDT 2006

On Tue, Oct 10, 2006 at 03:59:11PM -0400, The Editor wrote:
> Great.  I take it this means the following should work fine then...
>         if (! PageExists($pp)) {
>                $newpage['text'] = ZAPtemplate("page");
>                UpdatePage($pp, $newpage, $newpage);
>                $m .= "Page $pp created.  ";
>                }

Well, the page history won't be "correct", since UpdatePage
will be computing the page history between the new page text
and itself.

Personally (without having looked at the surrounding code),
I'd do the following:

    if (!PageExists($pp)) $m .= "Page $pp created.  ";
    $oldpage = ReadPage($pp);
    $newpage['text'] = ZAPtemplate("page");
    UpdatePage($pp, $oldpage, $newpage);


More information about the pmwiki-users mailing list