AddPageForm

Summary: How to add new pages without creating a link first
Version:
Prerequisites: Last tested on PmWiki version: 2.beta26
Status:
Maintainer:
Discussion: AddPageForm-Talk
Categories: Forms, Links

Question

How can we add pages without creating broken links first?

Answer

The 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 default

Just 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 form

However, 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 Also

Contributors

  • Nils Knappmeier
  • Radu (put this page up and made some comments :)

See also

NewPageBox

NewPageForm

Comments

See discussion at AddPageForm-Talk