Extension:CustomSidebar

The CustomSidebar extension provides an easy way to customize the sidebar on a per-page basis. You may define the sidebar in-page or reference another page which contains the text. The sidebar text takes the same format as Mediawiki:sidebar.

Usage
sidebartext

sidebartext may contain the following elements. If the text does not return any valid elements, the default sidebar MediaWiki:Sidebar is used.

Standard MediaWiki:Sidebar syntax
You may specify the main layout of the sidebar using standard sidebar syntax.

Example: * Menu ** link1|Text 1 ** link2|Text 2

Reference to another page
If the sidebartext only contains a page name and no asterisks, that page will be used as the sidebar text. Any page in any namespace may be used.

Example: wiki page name

Variables and Template Support
Starting with version 0.2.0, magic word variables and simple template support have been added.

Variables
You may use any of the magic word variables within the sidebar text.

Simple Template Support
Templates with zero or one unnamed parameter will be transcluded as expected. Nested calls are not allowed, but included template pages will be processed recursively.

Example:
 * OK


 * 1) Not ok

$wgDefaultSideBarText
The text $wgDefaultSideBarText is similar to setting MediaWiki:Sidebar, only it can be set within LocalSettings.php and can use variables and templates. Example: This sidebar text will allow you to specify a sidebar for each "sub directory" $wgDefaultSideBarText = ':/Sidebar'

Using the above example, the contents of foo/Sidebar would be applied to the following pages as sidebar text
 * foo
 * foo/page 1
 * foo/page 2
 * foo/page 3
 * foo/etc

You can also use the default sidebar, though it is recommended to use a different page as the default sidebar, so that MediaWiki:Sidebar can be used in case the processed sidebar text does not return a valid sidebar.

$wgDefaultSideBarText = 'MediaWiki:Sidebar'

Downloads

 * CustomSidebar v0.2.0 - 05:37, 2 June 2009 (UTC)
 * CustomSidebar v0.1.0 - 08:18, 21 May 2009 (UTC)

Installation
To install this extension:
 * 1) Place CustomSidebar.php in the folder yourwikifolder/extensions/CustomSidebar/
 * 2) Add the following to LocalSettings.php:

v.0.2.0

 * Added variable and template support

v.0.1.0

 * First public release