官术网_书友最值得收藏!

  • MediaWiki Skins Design
  • Richard Carter
  • 381字
  • 2021-05-28 17:39:09

Initializing Your Skin

In order to view changes that have made to your skin's design, you need to make a few changes to MediaWiki. We need to inform MediaWiki that we want to view the wiki's content using a different skin from the default, that is, MonoBook.

CSS and Image Files

You will need to create a new directory in the skins directory, such as skins/yourskinname/, within your MediaWiki installation directory, where yourskinname is the name of your new MediaWiki skin.

To keep things simple, we will call our new skin jazzmeet, and store it in the skins/jazzmeet/ directory. The primary Cascading Style Sheets (CSS) file for each skin is usually in this skin directory and is known as main.css. But it can be changed in the header of your skin's PHP template. For example, the CSS file for our new skin should be located at skins/jazzmeet/main.css within our wiki's installation directory.

Note

You may find it useful to copy an existing skin directory, such as MonoBook (from skins/monobook/), and rename it for using it as your new skin's directory (for example, skins/yourskinname/).

shared.css in skins/common/ contains styles that are used by all of the skins. We can easily ignore this, as we can overwrite any unwanted style in main.css.

PHP Template

We need to carry out the following steps before we can start skinning MediaWiki:

  1. Create a PHP file named YourSkinName.php. in the skins/ directory.
  2. Open this file and edit the line that reads- class SkinMonoBook extends SkinTemplate to read class YourSkinName extends SkinTemplate, but replace YourSkinName with the name of your new skin.
  3. Find the line that reads class MonoBookTemplate extends QuickTemplate; to read class YourSkinNameTemplate extends QuickTemplate; Again, replace YourSkinName with the name of your new skin.
  4. Finally, you need to inform MediaWiki about your skin by inserting the following into the file:
$this->skinname = 'yourskinname'; $this->stylename = 'yourskinname'; $this->template = 'YourSkinNameTemplate';

Note

The convention in MediaWiki is to name your skin using CamelCase, for example, MonoBook and JazzMeet rather than Monobook and jazzmeet.

Be sure to replace your skin name with the directory's name (for example, $this->skinname = 'jazzmeet'), and YourSkinName with the name of your new skin as it is in the PHP filename.

Note

Be careful with variable and directory naming as they are case-sensitive.

主站蜘蛛池模板: 华池县| 乐亭县| 新龙县| 岫岩| 澎湖县| 涞水县| 岐山县| 金秀| 常宁市| 沂南县| 屏边| 天峨县| 灌云县| 肥乡县| 思茅市| 萝北县| 阿勒泰市| 乌兰察布市| 芜湖县| 梅州市| 张掖市| 黑河市| 安乡县| 桐柏县| 泾阳县| 贡山| 泽库县| 泽州县| 阜平县| 淮北市| 江西省| 枞阳县| 定州市| 浑源县| 龙南县| 麻江县| 张掖市| 吉木萨尔县| 贺州市| 湘乡市| 玉山县|