Skin:CustomPage

From MediaWiki.org
Jump to: navigation, search
MediaWiki skins manual - category
Crystal Clear device blockdevice.png
CustomPage

Release status: beta

Description Blank skin that basically does nothing
Author(s) Ike Hecht (Tosfostalk)
Latest version

0.1 (February 2016)

PHP >5.3
License GPL-2.0+
Download

Translate the CustomPage skin if it is available at translatewiki.net

Check usage and version matrix;

The CustomPage skin is a blank skin that basically does nothing. It is intended as a base skin for building easy simple skins from the ground up.

Installation[edit]

  • Download and place the file(s) in a directory called CustomPage in your skins/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
wfLoadSkin( 'CustomPage' );
  • YesY Done - Navigate to Special:Version on your wiki to verify that the skin is successfully installed.

Usage[edit]

Installing the skin makes it available to you so that you can now see how your pages look when they are not being displayed. That probably doesn't do much for you. Neither will making it your default skin, which will make your entire wiki blank. Your users probably will not appreciate that. What the skin does is that it makes it a bit easier for you to construct another very simple skin. You can even create multiple skins using this method.

Example[edit]

To create a very simple skin that inherits from this skin, first create a directory called CustomPageExample in your skins directory. Create a barebones skin.json with the following content:

{
	"name": "CustomPageExample",
	"ValidSkinNames": {
		"custompageexample": "CustomPageExample"
	},
	"AutoloadClasses": {
		"SkinCustomPageExample": "SkinCustomPageExample.php"
	},
	"ResourceModules": {
		"skins.customPageExample": {
			"styles": {
				"screen.less": {
					"media": "screen"
				},
			"scripts": "customPage.js"
			}
		}
	},
	"ResourceFileModulePaths": {
		"localBasePath": "",
		"remoteSkinPath": "CustomPageExample"
	}
}

Now create a barebones file named SkinCustomPageExample.php. It should contain:

<?php

class SkinCustomPageExample extends SkinCustomPage {

	public function __construct( $skinName, $skinFullName = 'CustomPageExample', $templateClass = null ) {
		parent::__construct( 'custompageexample', 'CustomPageExample', 'CustomPageTemplate' );
	}
}

And, of course, load the skin in your LocalSettings.php with:

wfLoadSkin( 'CustomPageExample' );

That's all that's required. Now, you can add a file named CustomPageExample.php in your SkinCustomPageExample directory. A simple example follows:

<h1 id="firstHeading" class="firstHeading"><?php $this->html( 'title' ) ?></h1><p><?php $this->html( 'bodycontent' ) ?></p>

The skin still doesn't do much, but you can jazz it up, and even add files named screen.less or customPage.js, since the resourcemodule you created in the skin.json will automatically be loaded.

See also[edit]