Руководство:Настройка темы оформления

From mediawiki.org
This page is a translated version of the page Manual:Skin configuration and the translation is 57% complete.

Эта страница объясняет администраторам, как настраивать оформление на вики.

Эта документация применима к MediaWiki 1.31+.

За основополагающей информацией по использованию тем оформления обратитесь к Справка:Темы оформления .

Для разработчиков, кто хочет создать новый Skin или изменить существующую, обратитель к Руководству:Как создать тему оформления MediaWiki для технической информации.

Загрузка тем

Архив MediaWiki включает в себя несколько встроенных тем оформления. See Bundled extensions and skins#Skins for a list.

Тем не менее, если вы загрузили MediaWiki из Git, или вы хотите установить дополнительные темы оформления, то вам будет нужно также отдельно загрузить код оформления.

Множество оформлений MediaWiki содержатся в git репозитории Викимедиа (смотрите полный список здесь). Вы можете загрузить архив со скинами из поставщика оформлений.

Выполните следующую команду, чтобы загрузить одну из этих тем с помощью Git:

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

e.g.: To get the default skin Vector, you should give the following from the skins/ subdirectory of your MediaWiki installation folder:

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

Checkout an appropriate release of the skin. Change into the new directory and run:

git checkout REL1_35

(replace REL1_35 with another release branch or tag)

Включение тем

Для каждого оформления в директории /skins, которое вы бы хотели использовать, необходимо включить в файле LocalSettings.php . Например, добавьте следующее, чтобы включить Vector. Если у вас несколько оформление, то каждое должно быть включено в отдельном объявлении:

// MediaWiki 1.24 or less
require_once "$IP/skins/Vector/Vector.php";
// MediaWiki 1.25+
wfLoadSkin( 'Vector' );

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

Могут понадобится дополнительные действия в зависимости от выбранной темы. Подробные инструкции по установки доступны на mediawiki.org для каждого оформления. Например, для Vector смотрите Skin:Vector#Installation. Инструкции для всех остальных оформлений аналогичны.

Установка темы по умолчанию

A default skin should be set for new users of a wiki by setting the variable $wgDefaultSkin in LocalSettings.php 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:

$wgDefaultSkin = 'vector';

Changing these values 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.

Удаление тем

Чтобы удалить тему оформления, удалите строку wfLoadSkin (или require_once в MediaWiki версии 1.24 и ниже) из вашего файла LocalSettings.php . После этого вы можете удалить файлы темы из каталога skins/.

Если кто-то использовал это оформление, которое вы только что удалили, MediaWiki автоматически переключит их на оформление по умолчанию.

Запретить использовать оформление без удаления

The administrator can limit the skin choices that are offered site-wide in user's preferences by listing skin(s) to suppress in the $wgSkipSkins 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 LocalSettings.php :

// To remove various skins from the User Preferences choices
$wgSkipSkins = array( "monobook", "timeless" );

Вы можете посмотреть как выглядит скин с помощью параметра URL useskin .

Модификация CSS для всего сайта

MediaWiki позволяет администраторам указать CSS для всего сайта, которые будут на каждую страницу. These rules can be added by editing the page Gadget-site.css (old Common.css) on your wiki, if $wgUseSiteCss 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).

Пользовательские модификации CSS

Пользователи также могут применять их CSS правила, создав страницу «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 $wgAllowUserCss to true in LocalSettings.php . 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.

Отключить возможность пользователям менять оформление в пользовательских настройках

Версия MediaWiki:
1.16

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.

$wgHiddenPrefs[] = 'skin';