[pmwiki-users] Page creation

The Editor editor at fast.st
Tue Oct 10 14:59:11 CDT 2006


On 10/10/06, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> On Tue, Oct 10, 2006 at 01:28:15PM -0400, The Editor wrote:
> > I'm trying to get ZAP to use the handle update function everywhere.  I
> > now have it deleting pages this way (to preserve the history), and was
> > thinking about how to create new pages.  Any thoughts on how to do
> > this code?  IE, what do I use for oldpage if no page exists?
>
> You can use either an empty array, or you could use the results of
> ReadPage even though the page doesn't exist.
>
> FWIW, PmWiki uses ReadPage even when the page doesn't exist.
>
> Pm


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.  ";
               }

Cheers
Caveman




More information about the pmwiki-users mailing list