Manual:Подвал (Footer)
Добавление ссылок в подвал
Версия MediaWiki: | ≥ 1.35 |
In MediaWiki 1.35, links can be added or overridden via the SkinAddFooterLinks hook. (See Manual:Footer/legacy for older installs.) For example, in an extension:
- Internal links
// Add a link to the page "Test Page" with the text "Test", allowing modification by wiki administrators
// test-desc and test-page are i18n messages with the text of the link and the name of the page, respectively
public static function onSkinAddFooterLinks( Skin $skin, string $key, array &$footerlinks ) {
if ( $key === 'places' ) {
$footerlinks['test'] = $skin->footerLink( 'test-desc', 'test-page' );
}
}
The two parameters passed to the skin::footerlink
function should be i18n message keys. This means the eventual value will be taken from the content of the MediaWiki namespace page corresponding to those message keys; in this case the contents of the pages MediaWiki:test-desc and MediaWiki:test-page.
The first parameter should contain the link text, the second the name of the page to link to. See the Class level documentation for more details.
- External links
// Add a link to this page (https://www.mediawiki.org/wiki/?curid=6031)
// test-desc is an i18n message of the text
public static function onSkinAddFooterLinks( Skin $skin, string $key, array &$footerlinks ) {
if ( $key === 'places' ) {
$footerlinks['test'] = Html::element( 'a',
[
'href' => 'https://www.mediawiki.org/wiki/?curid=6031',
'rel' => 'noreferrer noopener' // not required, but recommended for security reasons
],
$skin->msg( 'test-desc' )->text()
}
}
Or if you are a site admin you can do it in LocalSettings.php . See the examples for:
- Внутренние ссылки
Версия MediaWiki: | ≥ 1.35 |
$wgHooks['SkinAddFooterLinks'][] = function ( Skin $skin, string $key, array &$footerlinks ) {
if ( $key === 'places' ) {
$footerlinks['test'] = Html::element( 'a', [
'href' => Title::newFromText(
$skin->msg( 'test-page' )->inContentLanguage()->text()
)
], $skin->msg( 'test-desc' ) );
};
};
- Внешние ссылки
// Add a link to this page (https://www.mediawiki.org/wiki/?curid=6031)
// test-desc is an i18n message of the text
$wgHooks['SkinAddFooterLinks'][] = function ( Skin $skin, string $key, array &$footerlinks ) {
if ( $key === 'places' ) {
$footerlinks['test'] = Html::element( 'a',
[
'href' => 'https://www.mediawiki.org/wiki/?curid=6031',
'rel' => 'noreferrer noopener' // not required, but recommended for security reasons
],
$skin->msg( 'test-desc' )->text()
);
};
};
Настройка встроенных элементов
Вы также можете настроить отдельные встроенные элементы, изменив определенные страницы или параметры:
lastmod
- Редактируется MediaWiki:Lastmodifiedat. Если $wgMaxCredits включена то редактируете MediaWiki:Lastmodifiedatby. Вы также можете редактировать MediaWiki:othercontribs который показывает других участников. (6518)
credits
-
- Если $wgMaxCredits не равно нулю, то показываются редакторы страницы.
- то есть установите
$wgMaxCredits = 10;
или другое число.
copyright
- Редактируется в MediaWiki:Copyright. Параметр $1 на данной странице заменяется на ссылку об использовании авторских прав в Вашей Вики. В LocalSettings.php $wgRightsText для текстовой ссылки установите либо в переменной $wgRightsPage или в $wgRightsUrl с ссылкой на расположение внутренней вики страницы или внешний URL адрес.
privacy
- Это только ссылка. Задайте отображаемый текст ссылки в MediaWiki:Privacy и саму целевую вики-страницу в MediaWiki:Privacypage.
about
- Это только ссылка. Задайте отображаемый текст ссылки в MediaWiki:Aboutsite и саму целевую вики-страницу в MediaWiki:Aboutpage.
disclaimer
- Это только ссылка. Задайте отображаемый текст ссылки в MediaWiki:Disclaimers и саму целевую вики-страницу в MediaWiki:Disclaimerpage.
tagline
- в настоящее время не используется в подвале
Чтобы полностью удалить ссылки на «политику конфиденциальности», отказ от ответственности и другие ссылки в подвале, просто замените текст ссылки одним тире («-
»).
Изображения
- См.: $wgFooterIcons .
Текст и изображения
По состоянию на сентябрь 2016 года, по-видимому, не существует стандартного способа добавления записи, которая состоит из текста и изображения одновременно.