Writing mediawiki extensions

From ThorstensHome
Revision as of 14:28, 10 January 2015 by ThorstenStaerk (Talk | contribs)

Jump to: navigation, search

Here is the simplest mediawiki extension you can write:

  • in LocalSettings.php, add
  • create a file extensions/circlextension.php:

$wgExtensionFunctions[] = "wfcirclextension";

function wfcirclextension()
  global $wgParser;
  $wgParser->setHook("circle", "circlehtml");

function circlehtml($code, $argv)
  $result="<svg><circle r=50 /></svg>";
  return $result;
  • Now you can create a mediawiki page with the content
This is mediawiki-syntax
<circle "this goes into argv">
this goes into code
  • And you will see a circle on the resulting wiki page. Note the circle may not be complete.