Manual:Skinning/Archive

This page contains instructions on how to create a skin for MediaWiki.

The term FooBar will be used as a placeholder for the newly-created skin's name. (Notice the use of the uppercase  and the lowercase   in different contexts.)

There is also a more general walkthrough here.

File Locations
All skin files are located in the  subfolder of the MediaWiki installation directory (see $wgStylePath and $wgStyleDirectory for actual location.)

There are two files for each skin in that folder:
 * : The main file, defining the page layout.
 * : a workaround for a bug in the APC opcode cache on PHP 5

For all other files, a subfolder with the skin's name should be created - for example:
 * : The FooBar skin's main style sheet
 * : browser-specific style sheet fixes

Code Structure and Elements
This section outlines the code structure of a typical MediaWiki skin.

The respective code portions have been extracted from MediaWiki's default MonoBook skin. For the full PHP code in its entirety, see /Example.

Dependencies
This section contains the dependency information about the skin to work around a caching bug in PHP 5.

Metadata
This section contains meta-information about the skin.

Initialization
This section sets up your skin to inherit from the main skin template class and shows the beginning of the template callback class. Here the required classes are defined. Instances of  and   need to be replaced with the skin's name. Usually nothing else in this section needs to be altered.

Page Elements
The following sections consist of page elements that your skin can use with an example usage. You can use page elements in whatever order you like or alter the way you use these elements. Elements presented below are in the order that the Monobook skin uses them.

Site Notice
[conditional]

Page Subtitle
(e.g. redirect notice)

Undelete Notice
[conditional]

User-Messages Notification
[conditional]

Jump-To Links
(intra-page navigation) [conditional], [optional]

Category Links
[conditional]

Page Toolbar
[iterative]

User Toolbar
[iterative]

Sidebar Navigation
[iterative]

Footer
[iterative]

Closing Trail
This last section simply closes any sections from above and usually does not need to be altered.

Category List Fix
This is a fix for returning category links as a proper  element (instead of returning a mostly unordered string, which is the default behavior). These functions need to be placed in the class that extends SkinTemplate in your template file. If you want to see the mediawiki versions of these functions, look for them in Skin.php.

External

 * MediaWiki Skins Design: Designing attractive skins and templates for your MediaWiki site by Richard Carter, ISBN 978-1847195203
 * SiteGround Tutorial about MediaWiki Skins
 * Creating a custom skin for MediaWiki 1.18+ by Dantman