Manual:Skin configuration/zh

此页面包含了管理员如何在一个维基中配置皮肤的所有信息. 一般的维基皮肤信息，请参考Help:Skins，如何开发一个新皮肤请参考Manual:Skinning.

本文档适用于MediaWiki 1.24及更高版本.

Downloading skins
MediaWiki压缩包下载拥有四款皮肤：Vector（默认皮肤）、MonoBook、Modern和Cologne Blue. 如果您使用它安装了MediaWiki的话，您已经有皮肤了！

然而，如果你从from Git下载的MediaWiki或者下载了nightly版本，又或者打算安装额外的皮肤，你需要单独下载皮肤的代码.

许多MediaWiki的皮肤都包含在Wikimedia的Git仓库（查看全部列表here）. 你可以从skin distributor下载皮肤压缩包.

想通过GIT下载库里面的皮肤，你可以使用一下命令

 git clone https://git.wikimedia.org/git/mediawiki/skins/[name of skin].git

e.g.: To get the default skin Vector, you should give the following from the  directory:

 git clone https://git.wikimedia.org/git/mediawiki/skins/Vector.git

Unfortunately, there is currently no way to download an additional skin other than via Git, but the mechanism to do such a thing is being developed.

After you have obtained the folder of a skin's files, place it as a subdirectory of  in your MediaWiki installation (you can place the Git repository there directly).

Enabling skins
For any skin in your /skins directory that you wish to use, you must add a  line for it to your  file. For example, to enable Vector, add the following:

(This is equivalent to enabling an extension, only in a different directory.)

Additional steps may be required depending on the choice of skin. Detailed installation instructions are available on each skin's page on mediawiki.org; for example, for Vector see Skin:Vector. Instructions for all other skins are analogous.

设置wiki的默认皮肤
A default skin should be set for new users of a wiki by setting the variable  in   to the lowercase skin name specified in the skin file. Users can still change their skin by going to their preferences page, unless you uninstall or suppress all other skins, or disable the preference altogether (see below). For example:

Changing these value on an existing wiki will automatically change the setting of all users who have been using the previous default skin. There is a maintenance script to change users' preferences (userOptions.php), but you will most likely not need to use it.

If you do not change this value, Vector will be the default skin.

卸载皮肤
要卸载皮肤，从您的LocalSettings.php文件移除 一行. 之后您可以从 目录移除皮肤文件.

If any users have been using the skin you just uninstalled, MediaWiki will automatically switch them to the default skin of the wiki.

在不卸载的情况下停用皮肤
The administrator can limit the skin choices that are offered site-wide in user's preferences by listing skin(s) to suppress in the  array. This might be useful if you want to test a new skin without letting users see it. To do this, put something like this in :

You will be able to preview the skin using the useskin URL parameter.

Site-wide CSS modifications
MediaWiki allows administrators to specify site-wide CSS rules to be added to every page rendered. These rules can be added by editing the page Common.css on your wiki, if  is set to true. In addition to a global stylesheet, one can also specify CSS rules to be used only in certain skins (see Manual:Interface/Stylesheets).

User CSS modifications
Users can also specify their own CSS rules by creating the page "User:Username/common.css". The CSS on this page is then applied to whatever skin the user is using. If the website is changed to a different default skin, the user's custom CSS will continue to work just as before. This feature can be enabled by setting  to true in. A user can also apply CSS to a specific skin by creating the page "User:Username/skinname.css". If a user uses the MonoBook skin for example, they would edit the page Special:MyPage/monobook.css.

Disable site users' ability to choose skins in user preferences
The system administrator can completely remove the "Skin" option so that it does not show up at all in User Preferences. This makes sense if your site will use a customized skin and would not look right in any other skin.

To do it, add a new line containing the following code to LocalSettings.php. It will remove the "Skin" option from preferences and the possibility to use the useskin parameter in the URL.