It's better when it's simple

User Tools

Site Tools



Compatible with DokuWiki

No compatibility info given!

plugin Add a link which allows a user to add a new page on your wiki

Last updated on

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with create, page

This plugin allows you to embed an input box that, when submitted, will create a new page on your wiki.

How to use

Simply write {{ANP>filename|link text}} in the page source.
Example: {{ANP>noname|Add new page}} will embed a form to create a page named “noname”

How to install

Create a file named 'lib/plugins/addpage/syntax.php'
Put this code into that file:

if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
 * All DokuWiki plugins to extend the parser/rendering mechanism
 * need to inherit from this class
class syntax_plugin_addpage extends DokuWiki_Syntax_Plugin {
     * return some info
    function getInfo(){
        return array(
            'author' => 'iDo',
            'email'  => '',
            'date'   => '12/08/2005',
            'name'   => 'AddNewPage Plugin',
            'desc'   => 'Ajoute une page a un wiki',
            'url'    => '',
     * What kind of syntax are we?
    function getType(){
        return 'substition';
     * Where to sort in?
    function getSort(){
        return 106;
     * Connect pattern to lexer
    function connectTo($mode) {
     * Handle the match
    function handle($match, $state, $pos, &$handler){
        $match = substr($match,6,-2); // Strip markup
        $match = preg_split('/\|/u',$match,2); // Split title from URL
        if (!isset($match[1])) $match[1] = NULL;
        return $match;
     * Create output
    function render($mode, &$renderer, $data) {
        if($mode == 'xhtml'){       		
            //$renderer->info['cache'] = FALSE;
            $renderer->doc .= '<div class="new">';
            $renderer->doc .= $this->AddNP($data);
            $renderer->doc .= '</div>';
            return true;
        return false;
	function AddNP($data) {
		$mRet.='<script type="text/javascript">';
		$mRet.='function ANPadd() {';
		$mRet.='var yourname= prompt(\'nom de la nouvelle page :\', \''.$data[0].'\');';
		$mRet.='if ( (yourname==\''.$data[0].'\') || (yourname==null) ) { ';
		$mRet.='alert(\'Merci de saisir un nom de page\');}';
		$mRet.='else {  location.href = "doku.php?id="+escape(yourname); }}';
		$mRet.='<a href="#" onClick="ANPadd();">'.$data[1].'</a>';
		return $mRet;
//Setup VIM: ex: et ts=4 enc=utf-8 :


ido [at] woow-fr [dot] com

Translation (French -> English)

French English
nom de la nouvelle page New page name
Merci de saisir un nom de page Please write a page name

Translation (French -> Spanish)

French Spanish
nom de la nouvelle page Nombre de la nueva página
Merci de saisir un nom de page Por favor, escriba el nombre de la página


Your comments:

Simply write {{ANP>filename|link text}} in the page source. Example: {{ANP>noname|Add new page}} will embed a form to create a page named “noname”

I don't understand. which is the page source?

The comment was badly formated. It is corrected now.

plugin/newpage.txt · Last modified: 2017-09-17 21:40 by werner.flamme