|
Cookbook /
AddPageFormSummary: How to add new pages without creating a link first
Version:
Prerequisites: Last tested on PmWiki version: 2.beta26
Status:
Maintainer:
Discussion: AddPageForm-Talk
QuestionHow can we add pages without creating broken links first? AnswerThe question mark links which appear on some pages and point to non-existing other pages are not broken links, they are invitations to create a new page. They are also a good way for people to check that they spelled properly the page names. However, to answer the question, there are two ways: default and automatic. Wiki defaultJust edit the URI in the Address field in the browser to place the name of the new page (or group) in the right position, e.g.: http://<domain.ext>/<path-to-wiki>/<groupname>/<pagename> Automatic, using a formHowever, if you don't want to let your users get their hands dirty and possibly mess up the URI, add the following to the top of your local/config.php:
if ($_GET['createfrom']!="") {
$pagename=MakePageName($_GET['createfrom'],$pagename);
}
$CreatePageForm='<form action="'.$ScriptUrl.'">
<input type="text" name="n" value="NameOfThePage" />
<input type="hidden" name="action" value="edit" />
<input type="hidden" name="createfrom" value="'.$pagename.'" />
<input type="submit" name="submit" value="Create" />
</form>';
Markup('createpage','directives','/\(\:createpage\:\)/e',
"Keep('$CreatePageForm')");
Then you can put the new markup (:createpage:) in a skin, template, included page or in pages where you want people to see the form: one text field followed by a Create button. Typing the name of a new page in the text field and pressing Create opens the edit page on the new page. See AlsoContributors
See alsoCommentsSee discussion at AddPageForm-Talk |