Mike Brawley Exploring the World!

23Nov/110

Create a MediaWiki Skin from MonoBook

Create MediaWiki Skin

You can create a skin all by yourself by following the steps provided below:
Go to the /skins folder within your Mediawiki directory;
Copy the /monobook directory and rename it with the name of your skin, for example:

mywikiskin

Copy the MonoBook.php file and rename it with the name of your skin, for example:

MyWikiSkin.php

Edit MyWikiSkin.php and change the class name to SkinMyWikiSkin, for example:

class SkinMyWikiSkin extends SkinTemplate;

In MyWikiSkin.php, change make the other class to have your skin name together with the word Template, for example:

class MyWikiSkinTemplate extends QuickTemplate;

In MyWikiSkin.php, make $this->skinname to have a string value of your skin name, for example:

'mywikiskin';

In MyWikiSkin.php, make $this->template to have a string value of your skin name properly capitalised with the word Template, for example:

'MyWikiSkinTemplate';

In MyWikiSkin.php find the following lines and replace monobook with mywikiskin in the path settings for the CSS files:

$out->addStyle( 'mywikiskin/main.css', 'screen' );
$out->addStyle( 'mywikiskin/IE50Fixes.css', 'screen', 'lt IE 5.5000' );
$out->addStyle( 'mywikiskin/IE55Fixes.css', 'screen', 'IE 5.5000' );
$out->addStyle( 'mywikiskin/IE60Fixes.css', 'screen', 'IE 6' );
$out->addStyle( 'mywikiskin/IE70Fixes.css', 'screen', 'IE 7' );
$out->addStyle( 'mywikiskin/rtl.css', 'screen', '', 'rtl' );

In your /mywikiskin directory edit the image and CSS files;
Edit and customise MyWikiSkin.php as you please;
In LocalSettings.php set

$wgDefaultSkin = 'mywikiskin'

You can now enjoy the new skin you have prepared!