User:Dantman/Skinning system/Metadata

From mediawiki.org

Instead of requiring a .php file to define new skins we'll have a metadata file that will define most of what we need in a skin. Additionally it'll replace i18n for the most common i18n cases (name and description i18n) instead of forcing i18n files to be used when a skin does not actually use messages inside it. Unless someone can find a cleaner syntax that offers the things we need inside the metadata file it will likely use xml.

The file is expected to be found at skins/skinname/skinname.xml, we may let skins/skinname/altskin.xml work as well.

The root element for the metadata file is <skin>, an example:

<skin>
	<name lang="en">Skin Name</name>
	<description lang="en">The skin description.</description>
	<template primary="true">skinname.tpl</template>
	<links-definition>skinname.dfn</links-definition>
	<resource>
		<style common="elements" />
		<style common="content" />
		<style common="interface" />
		<style media="screen">skinname.css</style>
	</resource>
</skin>

<name>[edit]

<name> defines the name of the skin. You may have multiple name blocks, every <name> must have an associated lang="". The name will be used to populate the i18n skin name.

<description>[edit]

<description> defines the description for the skin. Like <name> you may have multiple name blocks and every one must have an associated lang="" and will be put into i18n.

<template>[edit]

Defines the primary and potentially additional templates for the skin. If you only have one <template> it will implicitly be considered primary. If you have more than one you must set a 'primary' attribute on the element.

<links-definition>[edit]

Defines the file to use to organize the link tree for this skin. The path is relative.

<resource>[edit]

<resource> defines a resource loader module for the skin. A resource may contain a name="..." attribute defining the name of the module. A resource may include a 'load' parameter to make the skin system load it by default when the skin is used. If a name is not set on your first module it will be given the name "skin.$skinname" will automatically be loaded. Every resource after the first must define a name.

A resource may contain the following sub-elements to define the module.

<style>[edit]

Defines a stylesheet to be used in the module. A <style> block may be used in one of two forms:

  • <style common="elements|content|interface" />
  • <style media="...">path</style>

In the first form with a common="" of one of element, content, or interface the block will define inclusion of our common/commonElement.css, common/commonContent.css, or common/commonInterface.css stylesheets.

The second form defines a stylesheet in your skin. A media="" must be defined with one of the usual expected media types such as screen, print, etc... The path is relative to your skin folder so do not include the name of your skin's directory inside of it.