MediaWiki/archive/customizing/new Special page

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< MediaWiki‎ | archive‎ | customizing
Revision as of 23:13, 12 November 2006 by Woozle (talk | contribs) (also need to change code in the new page)
Jump to navigation Jump to search

Navigation

computing: software: wiki: MediaWiki: creating a custom Special page

Instructions

This procedure was determined by experimentation; there doesn't seem to be any official documentation yet.

  1. Copy an existing Special page to use as a template; they are in the includes/ folder, and are named Special*.php (first character of "*" should be capitalized). Whatever you use as the "*" becomes the variable-name for the new page; I'll use "Tester" as an example.
  2. The new Special page must define a function called "wfSpecial*()" ("wfSpecialTester()" in this example). It calls a function ending in _gen(), which must also be uniquely named among all the Special pages, so naming it "wfSpecialTester_gen()" is a good custom. Note that the calls to the _gen() function must also be changed to the new name (there are two of them in wfSpecialTester()).
  3. Edit SpecialPage.php and add a line to the initialization of the $wgSpecialPages array:
'Tester'		=> new SpecialPage( 'Tester' ),
  1. Create a new page called Mediawiki:Tester; its contents become the title of the new page. This title will show up in Special:Specialpages, too.

Note for MediaWiki developers: see how the insertion of a code-block in the above list breaks the numbering, even though there are no blank lines? We need some way to prevent that, or at least to hard-code the initial number in a sequence.