Manual:$wgNamespacesWithSubpages

From MediaWiki.org

Jump to: navigation, search
Namespaces: $wgNamespacesWithSubpages
Which namespaces should support subpages?
Introduced in version: pre 1.1.0
Removed in version: still in use
Allowed Values: (see below)
Default Value: (see below)

Other settings: Alphabetical | By Function


Contents

[edit] Details

The variable holds an array of namespaces, numbered from -1 (Special:) and not including -2 (direct-linked media) indicating which namespaces allow sub-pages. The array is indexed by the numeric namespace ID, and each index holds either 0 (no sub-pages) or 1 (sub-pages allowed).

See Help:Subpages

[edit] Default value

The default is to enable subpages, but not within the 'main' namespace. They are enabled only within talk pages and user pages.

Note: Enabling on all 'talk' pages actually requires many entries in this array; one for each talk namespace. Each version of MediaWiki only went as far as the maximum namespace existing at the time.

[edit] 1.5.0 and above

array(
        NS_TALK           => true,
        NS_USER           => true,
        NS_USER_TALK      => true,
        NS_PROJECT_TALK   => true,
        NS_IMAGE_TALK     => true,
        NS_MEDIAWIKI_TALK => true,
        NS_TEMPLATE_TALK  => true,
        NS_HELP_TALK      => true,
        NS_CATEGORY_TALK  => true
 );

[edit] Prior to 1.5.0

The NS_ constants weren't used (possibly because they weren't defined) so numeric values were used instead:

array( -1 => 0, 0 => 0, 1 => 1, 2 => 1, 3 => 1, 4 => 0, 5 => 1, 6 => 0, 7 => 1, 8 => 0, 9 => 1, 10 => 0, 11 => 1)

[edit] Enabling for a namespace

The normal way to enable subpages for a given namespace is to edit the LocalSettings.php and insert the following:

# Enable subpages in the main namespace
$wgNamespacesWithSubpages[NS_MAIN] = true;

This adds an item (a 'true' value) to the $wgNamespacesWithSubpages array which is already defined in defaultSettings.php

[edit] Namespace names

The names for namespaces are set in files such as those listed in m:Locales for the Wikimedia projects, with default m:Language.php:

/* private */ $wgNamespaceNamesEn = array(
        NS_MEDIA            => 'Media',
        NS_SPECIAL          => 'Special',
        NS_MAIN             => '',
        NS_TALK             => 'Talk',
        NS_USER             => 'User',
        NS_USER_TALK        => 'User_talk',
        NS_WIKIPEDIA        => $wgMetaNamespace,
        NS_WIKIPEDIA_TALK   => $wgMetaNamespace . '_talk',
        NS_IMAGE            => 'Image',
        NS_IMAGE_TALK       => 'Image_talk',
        NS_MEDIAWIKI        => 'MediaWiki',
        NS_MEDIAWIKI_TALK   => 'MediaWiki_talk',
        NS_TEMPLATE         => 'Template',
        NS_TEMPLATE_TALK    => 'Template_talk',
        NS_HELP             => 'Help',
        NS_HELP_TALK        => 'Help_talk',
        NS_CATEGORY         => 'Category',
        NS_CATEGORY_TALK    => 'Category_talk'
);
Personal tools