Extension:HideNamespace
From MediaWiki.org
|
Release status: stable |
|||
|---|---|---|---|
| Implementation | Parser function, MyWiki | ||
| Description | Hides namespace in the header and title when a page is in specified namespace or when the {{#hidens:}} parser function is called. You can also use {{#unhidens:}} to override the hiding individually. | ||
| Author(s) | Matěj GrabovskýTalk | ||
| Last Version | 1.1 (2009-09-02) | ||
| MediaWiki | 1.15 | ||
| License | GPL 2.0 or later | ||
| Download | /Code | ||
|
|||
|
|||
|
check usage (experimental) |
|||
HideNamespace enhances MediaWiki with ability to hide namespace in page title and its header.
Contents |
[edit] Usage
This extension has two main functionalities. They're both explained in the following sections.
[edit] The $wgHideNsNamespaces array
The first option is to use global variable $wgHideNsNamespaces. By specifying namespaces in the $wgHideNsNamespaces array you can hide the namespace prefix in all pages within the namespaces.
Example (put in LocalSettings.php after including the extension file):
$wgHideNsNamespaces = array( NS_FILE, NS_USER, NS_USER_TALK, );
This would hide the namespace prefix in all pages within the “File”, “User”, and “User talk” namespaces. Thus if there's a user page with name “User:Foo Bar”, it'd become “Foo Bar” when you visit the page.
[edit] Parser functions
The second option is to hide/unhide namespaces with two parser functions: {{#hidens:}} and {{#unhidens:}}. Those two parser functions don't take any parameters.
Example:
{{#hidens:}}
Foo bar. Baz, 1926.
== See also ==
* [[BarBarBar]]
If the previous page would be called, for instance, “Help:Bark”, it would become just “Bark” when you visit the page.
Other example:
{{#unhidens:}}
Hello, my name's Joe. You can leave me a message on my talk page.
If we would define the $wgHideNsNamespaces variable as in the very first example and the previous page would be called “User:Joe Doe”, the page title would still be “User:Joe Doe” when you visit the page, because you've overriden the setting with the {{#unhidens:}} parser function.
[edit] Download instructions
Copy and paste the code from this page and place it in $IP/extensions/HideNamespace/HideNamespace.php, HideNamespace.i18n.php, HideNamespace.i18n.magic.php respectively. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.
[edit] Installation
To install this extension, add the following code to your LocalSettings.php:
# HideNamespace extension require_once( "$IP/extensions/HideNamespace/HideNamespace.php" ); # Put the namespaces here $wgHidensNamespaces = array();