- 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.
- Adobe創意大學After Effects CS5 產品專家認證標準教材
- GIMP 2.6 cookbook
- Microsoft Visual C++ Windows Applications by Example
- Premiere Pro 2022短視頻剪輯、調色與特效制作實戰(全彩微課版)
- 中文版After Effects CC實用教程
- 架構之美
- Premiere Pro 2022從新手到高手
- Adobe 創意大學動漫設計師Flash CS5 + Photoshop CS5 標準實訓教材
- Blender 3D 2.49 Architecture, Buidlings, and Scenery
- Mastering phpMyAdmin 3.1 for Effective MySQL Management
- AutoCAD 2020從入門到精通
- 深入理解OpenCV:實用計算機視覺項目解析(原書第3版)
- 碼上學會:中文版Creo 3.0機械設計全能一本通(雙色版)
- Oracle Enterprise Manager Grid Control 11g R1: Business Service Management
- Building Websites with ExpressionEngine 1.6