- MediaWiki Skins Design
- Richard Carter
- 448字
- 2021-05-28 17:39:13
Changing the Logo
One of the most obvious things that can be done to alter the appearance of your wiki is to change the logo. The following ways can be used to achieve this in MediaWiki:
- Changing the logo image located at
skins/common/images/wiki.png
- Changing the
$wgLogo
parameter in theLocalSettings.php
file (in the root directory of your MediaWiki installation) - Adding the relevant XHTML to your skin's PHP file (for example,
skins/ JazzMeet.php
)
The Logo File
In MonoBook, the logo is not inserted as an <img>
element directly in to the XHTML. It is set as a background image through the use of inline CSS.
<div class="portlet" id="p-logo"> <a style="background-image: url(<?php $this->text('logopath') ?>);" <?php ?>href="<?php echo htmlspecialchars($this->data['nav_urls'] ['mainpage']['href'])?>"<?php echo $skin->tooltipAndAccesskey('n-mainpage') ?>></a> </div>
The default size for logo images is 135 pixels by 135 pixels. This is the universal size that is been used for all the default skins that are supplied with MediaWiki.

MediaWiki assumes that the logo is in Portable Network Graphic (PNG) format, although this can be altered.
Of course, with JazzMeet, we will need the logo to be of a different size than the default, as it is rectangular rather than square.

This can be achieved by specifying our own XHTML in JazzMeet's PHP skin template file.
Changing Your Logo in the PHP File
Your wiki's logo can be changed in the PHP template file, stored in skins/
. We called this file JazzMeet.php
. Find the #p-logo
div in this file.
<div class="portlet" id="p-logo"> <a style="background-image: url(<?php $this->text('logopath') ?>);" <?php?>href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"<?php echo $skin->tooltipAndAccesskey('n-mainpage') ?>> </a> </div>
Replace the content within this div with your own logo XHTML. For JazzMeet, this will be as follows:
<div class="portlet" id="p-logo"> <a title="JazzMeet"> <img src="skins/jazzmeet/jazzmeet-logo.png" alt="JazzMeet logo" /> </a> </div>
Changing the Logo in LocalSettings.php: $wgLogo
To change your wiki's logo using the LocalSettings.php
file, find the line that begins with $wgLogo
, and replace its value with the path to your logo image, relative to the root directory of your MediaWiki install. Alternatively, you can specify an absolute path, such as this: http://www.example.com/wiki/skins/jazzmeet/logo.png.
For example, if your wiki has been installed in www.example.com/wiki/, and your logo file is in www.example.com/wiki/skins/jazzmeet/logo.png, the code in the LocalSettings.php
file should be as follows:
## Logo file to add (called in TemplateName.php) $wgLogo = "skins/jazzmeet/logo.png";
Changing the Logo File
By replacing the logo file, wiki.png
, in the skins/common/images/
directory, you can instantly change your wiki's logo. This directory is the default location for the wiki's logo, which is used even if the $wgLogo
parameter in the LocalSettings.php
file is not set.
- Excel商務數(shù)據(jù)分析與應用(慕課版)
- 穿越Photoshop CC
- UG NX 9.0中文版 基礎(chǔ)教程 (UG工程師成才之路)
- PowerPoint 2019從入門到精通(移動學習版)
- AutoCAD 2014實用教程(第4版)
- Photoshop CS6實戰(zhàn)基礎(chǔ)培訓教程(全視頻微課版)
- After Effects CS6入門與提高
- Drupal 6 Panels Cookbook
- BlackBerry Enterprise Server 5 Implementation Guide
- Photoshop CC UI設(shè)計標準培訓教程
- AutoCAD 2024建筑設(shè)計從入門到精通(升級版)
- Photoshop CC移動UI設(shè)計實用教程
- AutoCAD 2016入門與提高(超值版)
- OpenCV項目開發(fā)實戰(zhàn)(原書第2版)
- Plone 3 for Education