MediaWiki Developer's Handbook/Special Pages

This will show you how to create a special page.


if (!defined("MEDIAWIKI")) {
 die("not a valid entry point!");
$wgExtensionCredits['specialpage'][] = array (
 'name' => 'My Special Page!',
 'author' => 'Me',
 'url' => '',
 'description' => 'A cool special page',
 'version' => '1.2.3',
$wgAutoloadClasses['MySpecialPage'] = $dir . "MySpecialPage_body.php";
$wgSpecialPages['MySpecialPage'] = 'MySpecialPage.php';

This file registers the special page.


class MySpecialPage extends SpecialPage {
 function __construct() {
 function execute($par) {
  global $wgOut;
  $d = str(mt_rand(1, 10));
  $output = "Hello! Your lucky number is '''$d'''!";

This is the special page itself. It should say something like Hello! "Your lucky number is 3"!

Introduction |Software Architecture |Programming Extensions |Parser Extensions |Adding new tags |Special Pages |Query Pages |HTML Form Pages |Editor Extensions |Add Button |References |Class Reference |Globals Reference |Hooks Reference |Literature

Last modified on 16 August 2010, at 21:24