MediaWiki修改:皮肤
天下维客,你可以修改的网络知识库
本文取自元维基,欢迎共同翻译、整理与大家共享,促进中文wiki发展^_^
This page might be obsolete.
目录 |
[编辑]
Opening external links in a new window
[编辑]
在新窗口打开外部链接
[编辑]
Interwiki-Links
Every interwiki-link inside the "interwiki" table that is extended with the target attribute:target="_blank"will open up in a new window (tab).
Note, however, that this violates the W3C's Web Content Accessibility GuidelinesCheckpoint 10.1[1] and is often considered a Generally Bad Idea.[2][3][4]
[编辑]
External http-links
- Open the file /includes/Linker.php
- Search for the function
function getExternalLinkAttributes( $link, $text, $class='' )
- Replace
$r = ($class != '') ? " class='$class'" : " class='external'";
for$r = ($class != '') ? " class='$class' target='_blank'" : " class='external' target='_blank'";
- It lacks a check to see if a http-link is actualy within the mediawiki-domain.
[编辑]
Create adjustable menus
[编辑]
Skin MonoBook
(Note: This hack has been made obsolete by version 1.5.X, just modify MediaWiki:Sidebar to do the same thing as below.)
This contribution is only compatible with the Skin MonoBook.
- Insert a new page in the Namespace MediaWiki; for example MediaWiki:NavigationMenu
- Insert content into this page, according to the Mediawiki content format; for example:
* [[Main Page]] * [[Fundraising]] * [http://www.external_link.org external http-link]
- Open the file skins/MonoBook.php
- search for
<h5><?php $this->msg('navigation') ?></h5>
<div class="pBody">
<ul>
<?php foreach($this->data['navigation_urls'] as $navlink) { ?>
<li id="<?php echo htmlspecialchars($navlink['id'])
?>"><a href="<?php echo htmlspecialchars($navlink['href']) ?>"><?php
echo htmlspecialchars($navlink['text']) ?></a></li><?php } ?>
</ul>
</div>
and replace
<ul>
<?php foreach($this->data['navigation_urls'] as $navlink) { ?>
<li id="<?php echo htmlspecialchars($navlink['id'])
?>"><a href="<?php echo htmlspecialchars($navlink['href']) ?>"><?php
echo htmlspecialchars($navlink['text']) ?></a></li><?php } ?>
</ul>
for:
<?php $this->msgWiki( 'NavigationMenu' ) ?>
- The code should now look like this:
<h5><?php $this->msg('navigation') ?></h5>
<div class="pBody">
<?php $this->msgWiki( 'NavigationMenu' ) ?>
</div>
原文参见: Skins Hacks


