[Pmwiki-users] from to creating new page

Knut Alboldt pmwiki
Thu Nov 4 06:54:47 CST 2004


I want to create a markup which displays a entry form to enter the name of a new 
page.
When submitted, the new page should be opened in edit-mode.

The following code (copied a bit from PITS.php) is supposed to do this (but it 
of course doesn't, either I wouldn't sent this :-)

#------------------------
Markup('createnewpage','directive','/\(:createnewpage\s+(.*):\)/e','Keep(CreateNewPage($pagename,"$1"))');
function CreateNewPage($pagename,$prefix)
{
   $Group = FmtPageName('$Group',$pagename);

   $out[] = "<form title='$[creating specified new page in group] $Group' 
method='post'>";
   $out[] = "  <input type='hidden' name='action' value='edit' />";
   $out[] = "  <input class='formbutton' type='submit' name='post' value=' 
$[create new page]: ' />";
   $out[] = "  <input class='formtext' type='text' name='pagename' width='20' 
value='$prefix' />";
   $out[] = "</form>";
   return FmtPageName(implode("\n",$out),$pagename);

}

When I enter the new name and submit the form the same page is shown again and 
the text is replaced by:

"newpagename:)(:groupfooter"

So what's wrong ?

Knut



More information about the pmwiki-users mailing list