Difference between revisions of "MediaWiki/archive/customizing/new Special page"
< MediaWiki | archive | customizing
Jump to navigation
Jump to search
(also need to change code in the new page) |
m (Woozle moved page creating a custom Special page in MediaWiki to MediaWiki/archive/customizing/new Special page without leaving a redirect: probably quite obsolete) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
# 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. | # 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. | ||
− | # The new Special page must define a function called "wfSpecial*()" ("wfSpecialTester()" in this example | + | # The new Special page must define a function called "wfSpecial*()" ("wfSpecialTester()" in this example). |
# Edit SpecialPage.php and add a line to the initialization of the $wgSpecialPages array: | # Edit SpecialPage.php and add a line to the initialization of the $wgSpecialPages array: | ||
'Tester' => new SpecialPage( 'Tester' ), | 'Tester' => new SpecialPage( 'Tester' ), | ||
# 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. | # 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. | ||
+ | # Now you can modify the code in SpecialTester.php to do whatever it was you wanted to do. | ||
''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.'' | ''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.'' |
Latest revision as of 23:46, 14 December 2017
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.
- 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.
- The new Special page must define a function called "wfSpecial*()" ("wfSpecialTester()" in this example).
- Edit SpecialPage.php and add a line to the initialization of the $wgSpecialPages array:
'Tester' => new SpecialPage( 'Tester' ),
- 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.
- Now you can modify the code in SpecialTester.php to do whatever it was you wanted to do.
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.