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 indicating which namespaces allow sub-pages. The array is indexed by the numeric namespace ID, and each array value is either 0 (no sub-pages) or 1 (sub-pages allowed).

See Help:Subpages

[edit] Enabling for a namespace

See also Manual:Namespace constants for a list of the NS_... codes.

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;
 
# Enable subpages in the template namespace
$wgNamespacesWithSubpages[NS_TEMPLATE] = true;
 
# etc.

[edit] Disabling for a namespace

Disable subpages in a namespace (where it is enabled by default). For example NS_TALK has subpages enabled by default in MediaWiki. To disable them, set false:

$wgNamespacesWithSubpages[NS_TALK] = false;

[edit] Enabling for all namespaces

# Enable subpages in all namespaces
$wgNamespacesWithSubpages = array_fill(0, 200, true);

This assumes you have no more than 200 namespaces.

[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
 );
Language: English  • français • 日本語 • 中文
Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox