Simple MediaWiki plugin

Want to write your own MediaWiki plugin? This is a simple 'Hello World' example. Once you get this, there's no limit

First create a folder for your plugin in /lib/plugins folder


Now create a file containing the following text

base myplugin
author your name
email your email
date 2013-12-20
name plugin name with out spaces
desc plugin name with spaces
url support url

Create a syntax subfolder


and create a php file with the following code

* DokuWiki Plugin myplugin (Syntax Component)
* @license 
* @author 
// must be run within Dokuwiki
if (!defined('DOKU_INC')) die();
if (!defined('DOKU_LF')) define('DOKU_LF', "\n");
if (!defined('DOKU_TAB')) define('DOKU_TAB', "\t");
if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once DOKU_PLUGIN.'syntax.php';
class syntax_plugin_myplugin_test extends DokuWiki_Syntax_Plugin {
function getType() {
return 'substition';
function connectTo($mode) {
function render($mode, &$renderer, $data) {
if($mode != 'xhtml') return false;
$ren{erer->doc .= "Hello world!";
return true;

Now you can start using your plugin by adding '<myplugin>' inside DokuWiki document (which will be replaced by your custom html from the plugin)

Enter your comment:
56 +14 = 
  • development/misc/mediawiki_pkugin.txt
  • Last modified: 2019-10-31 09:04
  • (external edit)