MediaWiki/Theming: Difference between revisions

example clarified
updates info on how to make your own skin by referring to Daniel Friesen's tutorials and the manual
Line 64: Line 64:


== How to make your own skin ==
== How to make your own skin ==
A skin generally has it's own directory, plus two setup files.
[[mw:User:Dantman|Daniel Friesen]] offers a [https://blog.redwerks.org/2012/02/28/mediawiki-subskin-tutorial/ good tutorial] on how to subclass the [[mw:Skin:Vector|Vector skin]] to create a new derivative skin. And his [https://blog.redwerks.org/2012/02/08/mediawiki-skinning-tutorial/ MediaWiki skinning tutorial] is the basis for the [[mw:Manual:Skinning Part 1|official manual on skinning]].
If you wanted to create a skin called 'Happy' you would have
<pre>
happy
Happy.php
Happy.deps.php
</pre>
in the 'skins' directory.
 
The easiest way to create your skin is to copy the monobook skin and start from there.
 
You can create a skin all by yourself by following the steps provided below:
 
# Go to your mediawiki 'skins' directory;
# Copy the monobook directory and name it with the name of your skin: happy;
# Copy the MonoBook.php file and name it with the name of your skin: Happy.php;
# Edit Happy.php and change the class name to SkinHappy: <source lang="php">class SkinHappy extends SkinTemplate;</source>
# In Happy.php, change the template class to have your skin name together with the word 'Template': <source lang="php">class HappyTemplate extends QuickTemplate;</source>
# Also in  Happy.php, make the references to the skin match the names:
<source lang="php">
$this->skinname  = 'happy'; // matches the physical directory name
$this->stylename = 'happy'; // matches the physical directory name
$this->template  = 'HappyTemplate'; // matches the template class name
</source>
# In your happy directory edit the image and CSS files until your heart is content;
# Edit and customise Happy.php as you please;


== Making your Skin Available ==
== Making your Skin Available ==