Release status: experimental
|Description||Allows administrator to define additional NS tabs besides Subject and Talk|
|Author(s)||Pavel Selitskas (Wizardisttalk)|
|Latest version||0.1 (2013-02-15)|
(since 13cecf9 for query support)
|License||GNU General Public License 2.0 or later|
Translate the NamespaceRelations extension if possible
|Check usage and version matrix; code metrics|
The NamespaceRelations extension allows an administrator to define additional namespace tabs besides Subject and Talk tabs in the interface. Whether the user is browsing Subject, Talk, or additional tabs, they will see the tabs all together.
Download[edit | edit source]
You can download the extension directly from the MediaWiki source code repository (browse code). You can get:
- One of the extensions tags
Not all extensions have tags. Some extensions have tags for each release, in which case those tags have the same stability as the release. To download a tag
- Go to the tags list
- Click the name of the tag you want to download
- Click "snapshot"
- The latest version of one of the extensions branches
Each extension has a master branch containing the latest code (might be unstable). Extensions can have further branches as well.
- Go to the branches list
- Click the branch name
- Click "snapshot"
- A snapshot made during the release of a MediaWiki version.
This might be unstable and is not guaranteed to work with the associated MediaWiki version.
After you've got the code, save it into the extensions/NamespaceRelations directory of your wiki.
If you are familiar with git and have shell access to your server, you can obtain the extension, with all its tags and branches, as follows:
cd extensions git clone
Installation[edit | edit source]
- Download and extract the files in a directory called
extensions/folder. If you're a developer and this extension is in a Git repository, then instead you should clone the repository.
- Add the following code at the bottom of your LocalSettings.php:
require_once( "$IP/extensions/NamespaceRelations/NamespaceRelations.php" );
- Done – Navigate to "Special:Version" on your wiki to verify that the extension is successfully installed.
Configuration parameters[edit | edit source]
NamespaceRelations is configured solely by defining $wgNamespaceRelations. The supported format and parameters are as follows:
$wgNamespaceRelations = array( 'key1' => array( 'namespace' => NS_MAIN, 'target' => 12, 'inMainPage' => true, 'query' => 'param1=value1¶m2=value2', 'weight' => 5, 'hideTalk' => true, 'customTarget' => 'Test/$1' ), // etc. );
- A key (ID) that is used in many places. It's the ID that is used in HTML rendering for actual element ID. Besides, it's used to find an appropriate message for the tab (via nstab-extra-key1).
- Namespace ID where the tab should be visible.
- Namespace ID where the tab should link.
- By default, if the tab is attached to NS_MAIN, the tab won't be visible on Main Page (imitating Wikinews Opinions tab behvaiour). However, this may be overridden by setting inMainPage to true. This parameter isn't obligatory and is intended only for namespace = NS_MAIN.
- Query string which action=edit&redlink=1 is attached to if the target page doesn't exist. Works since MediaWiki 1.21alpha (13cecf9).
- Sorting weight. Subject and Talk tabs receive 10 and 20 appropriately; if weight is not set, every custom tab receives +10 points starting from 30 (30 for the first custom tab, 40 for the next, etc.). This parameter allows to place custom tabs in almost every position relative to Subject, Talk and other custom tabs.
- Hide Talk tab.
- Custom target title. $1 is the base title (for example, "Page" will link to "Test/Page" in the target namespace.
You can define multiple tabs per one namespace which link to different targets, but you cannot define multiple tabs for different namespaces which linking to the same target — it creates ambiguous situation where we have 2+ Subject/Talk tabs (creating both — actually 4 tabs —– seems excessive). On the other hand, the first case (1 namespace → 2+ targets) works just fine.
Sample configurations[edit | edit source]
Wikinews[edit | edit source]
$wgNamespaceRelations = array( 'comments' => array( 'namespace' => 0, 'target' => 102, 'query' => 'preload=Wikinews:Commentary_pages_on_news_events/body&editintro=Template:Editintro_as-is' ) );
The messages are: nstab-extra-comments for caption, tooltip-ca-comments for tooltip.
Wiktionary[edit | edit source]
$wgNamespaceRelations = array( 'citations' => array( 'namespace' => 0, 'target' => 114 ), 'documentation' => array( 'namespace' => 10, 'target' => 10, 'customTarget' => '$1/doc' ) );
The messages are: nstab-extra-citations and nstab-extra-documentation for captions, tooltip-ca-citations and tooltip-ca-documentation for tooltips, respectively.
TODO[edit | edit source]
- attached namespaces should be treated the same way as talk pages when page moving takes place (that being said, when a page is moved and a special checkbox marked, the attached page is also renamed)