Skip to content

NewPage Module

Documentation > Modules > NewPage Module

Description

Displays a form that allows easier creation of new pages.

Attributes

attributerequiredallowed valuesdefaultdescription
categorynoname of a page categorynoneforces the given page category by prepending the page name by thecategoryname:/Note: Cannot use_defaultcategory for this.
templatenoname of a template pagenonea page (or comma-separated list of pages) to be used as a template for the new page
sizenoany positive integer30size of the displayed input field
buttonnoany string"create page"text displayed within thecreate pagebutton
formatnoany valid regular expressionnoneforces the input value to match the required format
tagsnospace-separated list of tagsnoneautomatically adds given tags to created pages
parentnoname of apageorcategory:pagenoneautomatically adds parent page to created pages

Attributes for AutoSave function

attributerequiredallowed valuesdefaultdescription
modenoedit,save-and-refresh,save-and-goedit"edit" takes you to an editor. "save-and-refresh" saves the page and refreshes the current page. "save-and-go" saves the page and goes to it (without editor) unlessgoToattribute is passed
goTonovalid page namenonespecifies which page to go to after automatically saving a page

Any page that would be used as a template (passed via the template attribute) must belong to the template category, i.e. its name should contain the template: prefix, e.g. template:pagename. And must already exist.

If you choose several templates (names separated by a comma) an additional field will be displayed asking to choose a template for the page that a user wishes to create.

If you want new pages to fit match a given pattern, you can use the format attribute. To learn more about regular expressions you can see the Pattern Syntax description at the PHP main page.

Anyway, you could do:

format="/^[0-9]{5}$/" — page names would consist of exactly 5 numbers

format="/^[\d]{4}[- \/.](0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])$/" — a simple expression to match a valid date (not 100% accurate, assumes all months have 31 days)

etc.

You cannot use NewPage module to create a hidden page (i.e. page whose name starts with an underscore — "_"). On the feedback site, there is a wish to change it. If you also feel this way, rate it up.

Examples

To make creating pages within the doc category:

[[module NewPage category="doc"]]

Results in:

(you will not be able to create a page in the documentation section - this is just for demonstration purposes).

To use a template:

[[module NewPage template="template:module"]]

To use several templates to choose from:

[[module NewPage template="template:module,template:howto"]]

And now a perfect module to insert into you side-bar for easier page creation:

+++ Add a new page
[[module NewPage size="15" button="new page"]]

Add a new page