It's better when it's simple

User Tools

Site Tools


Add New Page Plugin

Compatible with DokuWiki

  • 2013-12-08 "Binky" unknown
  • 2013-05-10 "Weatherwax" unknown
  • 2012-10-13 "Adora Belle" yes
  • 2012-01-25 "Angua" yes

plugin Put 'add new page' forms within pages, with optional namespace selection.

Last updated on

Similar to new_page_dialog, npd

Tagged with button, create, form

Needed for autoincludeindex

By iDo, Sam Wilson, Michael Braun


This plugin allows you to add new-page forms to wiki pages, so that users can simply enter the title of a new page and go straight to the editing form (rather than first creating a link to the page, or typing the URL directly).

The target namespace for the new page can either be selected from a drop-down list in the new-page form, or specified in the form syntax. Only namespaces to which the user is permitted to write are shown.

The form submit button is disabled if there is no text in the title field.


Put {{NEWPAGE}} anywhere in a wiki page to get a new-page-title text entry box, and a namespace selection drop-down menu. More details in the Syntax section below.

The default form has a drop-down with all namespaces of the wiki and a textfield for the pagename


See the plugin in action, and have a play with it, at:


Install the plugin using the Plugin Manager and the download URL above. Refer to Plugins on how to install plugins manually.


The basic syntax is:


Or, to specify a namespace:


Where namespace is the target namespace for the new page. When this is specified, the namespace selection box can either be hidden (which it is by default) or set to show only sub-namespaces of the given one. This is configured in the main wiki configuration manager. If @PAGE@ (or @NS@) is given, the current page ID (or its namespace) will be used (e.g. for use in namespace templates; see below).

Either of the above forms may be added multiple times on the same page.


The form, with target namespace 'test' as hidden input {{NEWPAGE>test}} with configuration option “Hide namespace selection” enabled.

The form with Namespace selection, drop-down menu restricted to 'test' namespace.{{NEWPAGE>test}} with configuration option “Hide namespace selection” disabled.

Site templates

To include an add-new-page form in a Site Template, use the following line:

<?php echo p_render('xhtml',p_get_instructions('{{NEWPAGE}}'),$info) ?>	

Namespace Templates

Add-new-page forms can also be added to Namespace Templates. The replacement patterns @ID@ and @NS@ can be used in the plugin's namespace parameter.

Configuration and Settings

You can configure the plugin in the Config Manager of DokuWiki. There are four settings:

  1. Excluded namespaces — A semicolon-separated list of namespaces that should be excluded from the namespace selection list. Default: wiki;playground.
  2. Show root namespace — Whether to show the wiki's root namespace in the namespace selection list. Default: true.
  3. Hide namespace selection — Hide the namespace selection list. Only applies if a namespace is given (see above). Default: true.
  4. Hide “access denied” message — Do not show the “You are not allowed to add pages” message when the user doesn't have permission to create pages. Default: false (i.e. do show the message).


Please report all bugs and feature requests through the issue-tracking system on Github. Items of general interest should be added to the FAQ below.

This plugin is based on the 'old addnewpage' plugin, and forked from that one after the 2009-02-14 release of Dokuwiki.


And from before development was moved to Github:

  • 2008-01-10: New zip file with some correction (the submit bug in IE, the namespace ”.”) and all new language are added
  • 2007-05-19: Portuguese language definitions added for completely hide NEWPAGE by GibaPhp
  • 2007-01-21: Can configure if you want to add some message about rights or completely hide NEWPAGE
  • 2007-01-21: Now support ACL (thanks to 66[dot]7[dot]118[dot]82)
  • 2007-01-13: Add new functionality with the syntax {{NEWPAGE[>namespace]}} (thanks to Martin)
  • 2007-01-12: Remove 4 invisible hex chars in script.js, adding Italian and Russian (incomplete)
  • 2007-01-11: Fix encoding problem (with old noaccent function)
  • 2006-12-20: New Release, old version [used to be] at plugin:addnewpage_old

And from when this plugin was addnewpage_old:

  • 2006-11-14: Fixed: bug with new dokuwiki version. Added italian language file.
  • 2006-07-05: Fixed: Zip file is now ok. Added: Russian language file.
  • 2006-06-20 : Fixed: Problem with the empty select box, Added: Multilanguage Support; Root Namespace (see Kibi's comment); The selected line is now the same as the current namespace (see Kibi's comment);


Addnewpage form on the admin page?

Is there a possibilty to add the plugin as a part of the admin page, like the plugins pagemove or upgrade? – oscon, 2010-11-15

Not currently, but this can be done by modifying your template and including the addnewpage form only when $ACT=='admin'

More than one form per page?

Is it possible to have more than one new-page form on a page?

Yes. Nothing special needs to be done to permit this, just add the markup wherever you want the forms to appear.

Newpagetemplate patch

I just added an action plugin that allows a user to specify a template to use when creating a page. The point of the plugin was to extend the addnewpage plugin so that the user could write something like:

{{NEWPAGE>ns|newpagetemplate=:pagetemplate:newpagetemplate&newpagevars=@NEWVAR@,test value}}

and the page :pagetemplate:newpagetemplate would function as a namespace template for the new page (i.e., the :pagetemplate:newpagetemplate would be copied into the edit box, with a few substitutions). I've modified the addnewpage plugin to accommodate this functionality. Basically what the modification does is parses everything following the “|” into separate hidden input fields in the form and then passes those along with the form. So really, you could specify whatever parameters you wanted to pass with the form using this new syntax.

Here's the patch:

--- syntax.php
+++ syntax.php
@@ -28,8 +28,8 @@
     function handle($match, $state, $pos, &$handler){
-         $ns = substr($match, 10, -2);  // strip markup
-      return $ns;
+          $ns = explode('|',substr($match, 10, -2),2);  // strip markup
+          return array(trim($ns[0]),trim($ns[1]));
@@ -38,7 +38,7 @@
                $renderer->info['cache'] = false;
                if ($mode == 'xhtml') {
-                       $cmb=$this->_makecombo($data);
+                       $cmb=$this->_makecombo($data[0]);
                        if ($cmb==$this->getLang('nooption')) {
                                $renderer->doc .=(!$this->getConf('addpage_hideACL'))?$cmb:'';
                                return true;
@@ -49,7 +49,15 @@
                    $renderer->doc .= $cmb;
                    $renderer->doc .= '<input class="edit" type="text" name="title" id="addnewpage_title" size="20" maxlength="255" tabindex="2" />';
                        $renderer->doc .= '<input type="hidden" name="do" id="do" value="edit" />';
-                   $renderer->doc .= '<input class="button" type="submit" value="'.((@$this->getLang('okbutton'))?$this->getLang('okbutton'):'ok').'" tabindex="3"  onclick="setName();" />';
+                        if(strlen($data[1])>1) {
+                         $t=explode("&",$data[1]);
+                         foreach($t as $value) {
+                           $parameter=explode("=",$value,2);
+                           $renderer->doc .= '<input type="hidden" name="'.htmlentities(trim($parameter[0]),ENT_QUOTES).'" id="'.htmlentities(trim($parameter[0]),ENT_QUOTES).'" value="'.htmlentities(trim($parameter[1]),ENT_QUOTES).'" />';
+                         }
+                       }
+                       $renderer->doc .= '<input class="button" type="submit" value="'.((@$this->getLang('okbutton'))?$this->getLang('okbutton'):'ok').'" tabindex="3"  onclick="setName();" />';
                    $renderer->doc .= '</form>';
                    $renderer->doc .= '</div>';

If you'd like to roll this into the official addnewpage plugin, that would be great! If you'd like to incorporate the action plugin newpagetemplate that I wrote into the addnewpage plugin, that would be great too. Thanks again for such a great plugin!

Regarding this patch: How can I apply it? I tried

cat the-patch.diff | patch -p0

in the plugin directory, but all three hunks were rejected. Any idea why?

– Niklas Volbers

you should run it within the addnewpage plugin directory; it modifies the syntax.php file; or you can get the modified syntax.php (remove the .txt at the end).

– Sergio

The patched syntax.php of the addnewpage-plugin is not available anymore in the above link. Could anybody please upload the patched code? Because of a lack of php-knowledge, I failed in patching it manually.

Only shows root namespace?

The combo only shows “root” is does not show the other namespaces - any reason why?

Show only particular subnamespaces?

Hello, I am trying to define a newpage button with a certain namespaces of a certain namespace showing on a combo box, but it is not working. The only way I can see a combo box is if I use {{NEWPAGE}} alone. Is it possible? I am trying the following syntax, where temadigital is a namespace that contains the namespaces that I would like the user to choose when creating a new page:


And also, I have noticed that the latest version of this plugin already have the changes made by Samuele Tognini. I have tried to apply the fix proposed just above, but it did not worked neither way. Thank you!


The namespace syntax doesn't use the square brackets, the presence of which is probably why you're not getting a combobox to show up. Try {{NEWPAGE>:temadigital}} instead.
And yeah, things will have changed since patches were posted here (and have done again since you posted). The current 'master' version of the plugin is on Github at the link given at the top of the page.
It does sound like a good idea though, being able to restrain the namespace list to a particular subset of NSs. If this is still important to you, do raise a feature request for it on Github. :-)
Sam WilsonSam Wilson

Fremantle, Western Australia
2013/03/06 07:27


Useful plugin. How about an addnewpage command action.

Hint: If you like to add an icon stored in “lib/images/icons/page_new.gif” you can use this in your template, when you have added action.php as described below.

<a href="<?php echo wl($ID, 'do=addnewpage')?>"><img src="<?php echo DOKU_BASE?>lib/images/icons/page_new.gif" alt="new PAGE" /></a>
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
class action_plugin_addnewpage extends DokuWiki_Action_Plugin
    var $doc;
    function getInfo ()
        return array(
            'author' => 'Peter Niebling',
            'email'  => '',
            'date'   => '5.7.2008',
            'name'   => 'addnewpage (action component)',
            'desc'   => 'Provides do=addnewpage command action',
            'url'    => '',
    function register ( & $controller )
        $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, '_handle_act', array());
        $controller->register_hook('TPL_ACT_UNKNOWN', 'BEFORE', $this, '_handle_tpl_act', array());
    function _handle_act( & $event, $param )
        if ( $event->data != 'addnewpage' )
    function _handle_tpl_act ( & $event, $param )
        if ( $event->data != 'addnewpage' )
        $this->doc = '';
        if (
            auth_quickaclcheck($_REQUEST['id']) >= AUTH_CREATE
            ( $syntax = plugin_load('syntax','addnewpage') )
            print('<h5>'.$syntax->getLang('okbutton').'</h5>'.$this->doc); // Title could be better ?!
            print p_locale_xhtml('denied');

Just copy the code into action.php in the addnewpage directory.

5.7.2008 Peter

Add page plugin doesn't work with non-English characters (subnamespace)

I just realized that if you put a subnamespace under a namespace written with non-English characters, the plugin won't work correctly.

Thanks everyone for helping with this bug. I've fixed it now, and am releasing a new version.
Sam WilsonSam Wilson

Fremantle, Western Australia
2013/06/20 07:14

Showing some namespaces in root but not all?

I installed this on Dokuwiki last release I think 4/11/2011 and I notice that only some items in the
root are displaying on the menu but not all sub-namespaces and not all namespaces? I'm not sure how to fix this?

Please update to the latest versions of DokuWiki (and plugins) and see if you're still getting this error. If you are, it would be terribly good of you if you could raise a bug report! :-) Thanks.
I suspect this may have been caused by non-latin characters in some of the namespaces and not others.
Sam WilsonSam Wilson

Fremantle, Western Australia
2013/06/20 07:48

add new namespace

Is there a way to create a new namespace with a fixed page for example. yournamespace:start (with :start as fixed value) `?

You can modify the lib/plugin/addnewpage/script.js:
-       var id = ns.val()+":"+title.val();
+       var id = ns.val()+":"+title.val()+":start";
but it has as disadvantage that you get always this postfix.

Delft, The Netherlands
plugin/addnewpage.txt · Last modified: 2014/03/15 18:50 by Klap-in