Difference between revisions of "Writing mediawiki extensions"

From ThorstensHome
Jump to: navigation, search
(Created page with "Here is the simplest mediawiki extension you can write: * in LocalSettings.php, add include("extensions/circlextension.php"); * create a file extensions/circlextension.php: ...")

Revision as of 14:19, 10 January 2015

Here is the simplest mediawiki extension you can write:

  • in LocalSettings.php, add
include("extensions/circlextension.php");
  • create a file extensions/circlextension.php:
<?php

$wgExtensionFunctions[] = "wfcirclextension";

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

function circlehtml($code, $argv)
{
  $result="<svg><circle r=50 /></svg>";
  return $result;
}