Jump to content

User:Egingell

From mediawiki.org

meta:User:Treader

Egingell's Hacks

Custom Sidebar per Namespace

Replace (global declaration) Line ~1589 in includes/Skin.php

Original
global $wgLang, $wgContLang;
New
global $wgLang, $wgContLang, $wgTitle;

Replace (sidebar definition) Line ~1609 in includes/Skin.php

Original
$lines = explode( "\n", wfMsgForContent( 'sidebar' ) );
New
alternate 1
// Change the default sidebar to a custom one (MediaWiki:Sidebar_[NS_NUM] if it exists) on any namespace,
// not just custom namespaces. If MediaWiki:Sidebar_[NS_NUM] doesn't exists, use MediaWiki:Sidebar.
$sideBar_str = wfMsgForContent( 'sidebar_'.$NameSpaceNumber );

if ($sideBar_str != '<sidebar_'.$NameSpaceNumber . '>' ) {
    $lines = explode( "\n", $sideBar_str );
} else {
    $lines = explode( "\n", wfMsgForContent( 'sidebar' ) );
}
alternate 2
// Change the default sidebar to include a custom one (MediaWiki:Sidebar_[NS_NUM] if it exists)
// on any namespace, not just custom namespaces.
$sideBar_str_default = wfMsgForContent( 'sidebar' );
$sideBar_str_custom = wfMsgForContent( 'sidebar_'.$NameSpaceNumber );

if ($sideBar_str_custom != '<sidebar_'.$NameSpaceNumber.'>' ) {
    $sideBar_str_default .= "\n" . $sideBar_str_custom;
}

// Remove dupes. See array_unique()
$lines = array_unique(explode( "\n", $sideBar_str_default ));

Info

MediaWiki:Sidebar => Default Sidebar
MediaWiki:Sidebar_[NS_NUM] => Custom Sidebar for [NS_NUM]

Note

You can get the namespace number from Special:Prefixindex. Look at the URL in the Location/Address bar of your web browser, it will look like this:

[Your Wiki Site]/index.php?title=Special%3APrefixindex&from=&namespace=[NS_NUM]

Extension:WoWItem

Uber Sidebar