====== NewPage ====== ---- plugin ---- description: Add a link which allows a user to add a new page on your wiki author : iDo email : ido@woow-fr.com type : syntax lastupdate : 2005-08-12 compatible : depends : conflicts : similar : tags : 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:\\ 'iDo', 'email' => 'iDo@woow-fr.com', 'date' => '12/08/2005', 'name' => 'AddNewPage Plugin', 'desc' => 'Ajoute une page a un wiki', 'url' => 'http://www.dokuwiki.org/plugin:newpage', ); } /** * 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) { $this->Lexer->addSpecialPattern("{{ANP>.+?}}",$mode,'plugin_addpage'); } /** * 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 .= '
'; $renderer->doc .= $this->AddNP($data); $renderer->doc .= '
'; return true; } return false; } function AddNP($data) { $mRet=''; $mRet.=''; $mRet.=''.$data[1].''; return $mRet; } } //Setup VIM: ex: et ts=4 enc=utf-8 : ?>
===== Contact ===== 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 | ===== Comments ===== 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.