Manual:Skinning/Archive

This page contains instructions on how to create a skin for MediaWiki. Needs update for 1.14 1.15 and 1.16!

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.

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.

Metadata
This section contains meta-information about the skin.

Initialization
Here the required PHP classes are defined. Instances of  and   need to be replaced with the skin's name.

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 function that extends SkinTemplate in your template file. If you want to see the mediawiki versions of these functions, look for them in Skin.php.

XHTML Output
This is the beginning of the Template filter callback, and usually does not need to be altered.

Head
The HTML head, including metadata, style sheets and scripts. This section usually does not require any adjustments, though the style sheets can be altered if desired.

Body (Page Elements)
The HTML body, composing the basic page structure.

The initial  tag's attributes usually do not require any adjustments.

Site Notice
[conditional]

User-Messages Notification
[conditional]

User Toolbar
[iterative]

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

Sidebar Navigation
[iterative]

Page Subtitle
(e.g. redirect notice)

Undelete Notice
[conditional]

Category Links
[conditional]

Page Toolbar
[iterative]

Footer
[iterative]

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

External

 * MediaWiki Skins Design: Designing attractive skins and templates for your MediaWiki site by Richard Carter, ISBN 978-1847195203
 * SiteGround Tutorial about MediaWiki Skins