NewPageBox
Question
How can I provide a form or box to allow users to create new pages?
Answer
The newpagebox.phpΔ script provides a (:newpagebox:)
markup which displays a simple box for creating pages:
(:newpagebox:) |
(:newpagebox:) |
(:newpagebox:)
allows a number of options:
base=pagename -- create page relative to pagename
- example:
(:newpagebox base=Test.HomePage :)
The new page gets created relative to page Test.HomePage, meaning it gets created in group 'Test'. See Sandbox below. Test.HomePage does not need to exist.
template=pagename -- use pagename as template for new page label=text -- use text as button label
example: (:newpagebox label='bowser':)
To install, copy the newpagebox.php file into the cookbook folder, and add the following to config.php:
include_once("cookbook/newpagebox.php");
Enhanced Alternative
- See NewPageBoxPlus for a further enhanced alternative.
As the original this alternative script adds markup to place a simple box with button to enter a new page name and submit it, which will take you to the new page ready to edit it.
This script adds additional functionality: The button can be placed either to the right or the left of the input box. The input box can have an initial text displayed inside the box, which will disappear as soon as the box is clicked to enter the new page name. The input box and button have additional class stylehooks "inputbox" and "inputbutton" which help integrated styling in a skin (used by Gemini Skin? and FixFlow Skin? for instance), i.e. you can use a generic class for both searchbox and newpagebox and other form elements for instance.
Use
Usage is the same as original script, by adding this markup to any wiki page:
(:newpagebox:) |
(:newpagebox:) |
Possible parameters to use inside the markup:
- base=Group.PageName -- create page in the same group as Group.PageName (PageName does not need to exist).
- template=Group.PageTemplateName -- use Group.PageTemplateName as template for new page.
- value="Create New Page" -- label or value for the inside of the field, which disappears when clicking the box. Default is empty: "".
- label="Button Label" -- label for the button, default "Create a new page called:".
- button=position -- use "left" or "right" to position button (default is "left").
Example:(:newpagebox base=Test.HomePage value="Create New Page" label=Go button=right :)
This creates an input box with "Create New Page" inside, and a button to the right of it with the label "Go". any new page will be created in the group "Test".
Installation
Install newpagebox3.phpΔ instead of the original newpagebox.php script. To install, copy the newpagebox3.phpΔ file into the cookbook folder, and add the following to config.php:
include_once("cookbook/newpagebox3.php");
Update History
- 4-Jan-06: newpageboxplus.phpΔ released with additional option parameters. See NewPageBoxPlus. ~HansB
- 11-Dec-05: (version 3.1) Renamed parameters: "button" becomes "label"; "field" becomes "value"; "position" becomes "button".
- 04-Dec-05: (version 3.0) newpagebox3, combining both 1 and 2 into a single script.
- newpagebox2.phpΔ deprecated in favour of newpagebox3.phpΔ. ~HansB
Notes
- newpagebox3.php can be integrated into the sidebar of Gemini?, FixFlow? and Triad Skins? by adding
(:newpagebox value="Create New Page" label=Go button=right:)
to the SideBar. It will automatically be sized smaller to fit into the SideBar and styled according to the color scheme. - The second option is not so good for release to new users, as it prefixes the box with the base pagename (and an arrow) when it is used, which scares them. Could the base page text possibly be omitted? Des 23/10/2005
- Entering PmWiki as name into the newpagebox form using a base=Test.HomePage parameter
(:newpagebox base=Test.HomePage:) |
(:newpagebox base=Test.HomePage:) |
will not create page Test.PmWiki, but redirects to editing PmWiki.PmWiki. Can the base= parameter get priority, before pmwiki looks for a possibly existing page in another group? - HansB
- This recipe was last tested on PmWiki version: 2.0.beta54
- This recipe requires at least PmWiki version:
See Also
Contributors
Comments
See discussion at NewPageBox-Talk?
Sandbox
(:newpagebox base=Test.HomePage:) |
(:newpagebox base=Test.HomePage:) |
Launch a new cookbook recipe page:
(:newpagebox base=Cookbook.Cookbook template=Cookbook.Template:) |
(:newpagebox base=Cookbook.Cookbook template=Cookbook.Template:) |
>>right<< (:newpagebox:) >><< |
(:newpagebox:)
|
Creating a page in a non-existing group:
(:newpagebox base=Test7.HomePage label="Create new page in Test7":) |
(:newpagebox base=Test7.HomePage label="Create new page in Test7":) |
User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.