Jump to content

Help:Custom namespaces

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Uncle G's 'bot (talk | contribs) at 21:53, 24 November 2005 (TRANSWIKI: Copied from Meta:Help:Custom namespaces.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
For information on custom namespaces on the Meta-Wiki, see Meta:Namespaces.

If you want to add a custom namespace, you need to do the following:

  1. Pick the names of your namespace and its talk page. Also pick numbers.
Note: Even numbers are for the main namespaces, odds for the talk pages. Custom pages start at 100. (Important: Do not include spaces in the name, use an underscore instead)
  1. Goto /includes/DefaultSettings.php and copy the variables $wgExtraNamespaces, $wgNamespacesWithSubpages, and $wgNamespacesToBeSearchedDefault into LocalSettings.php
    If $wgExtraNamespaces is not in DefaultSettings.php, you probably have an old version of MediaWiki (1.3.2 or older). You should upgrade to the current release, as there have been both bug fixes and some security fixes since then.
  2. Add to $wgExtraNamespaces the name of your namespace and its talk page, as it would appear in a link.
    • Example:
$wgExtraNamespaces =
       array(100 => "Foo", 
             101 => "Foo_Talk");
  1. If you want sub pages, add it to $wgNamespacesWithSubpages
    • Example:
$wgNamespacesWithSubpages = 
       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,
              100 => 1, 101 => 1 );
  1. If you want the new namespace (or its talk page) searched by default, set $wgNamespacesToBeSearchedDefault
    • Example:
$wgNamespacesToBeSearchedDefault =
       array( -1 => 0, 0 => 1, 1 => 0, 2 => 0, 3 => 0,
               4 => 0, 5 => 0, 6 => 0, 7 => 0,
               8 => 0, 9 => 1, 10 => 0, 11 => 1,
               100 => 1, 101 => 1 );

Note:

  • (Wiki 1.5) Per example in includes/DefaultSettings.php:
    • (Also see w:NameSpaces for complete detailed list)
/** Which namespaces should support subpages?
* See Language.php for a list of namespaces.
* Make any customized lists in LocalSettings.php.
*/
$wgNamespacesWithSubpages = 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
);
$wgNamespacesToBeSearchedDefault = array(
 	NS_MAIN           => true,
);

Note: Other pages for further Namespaces information: