Jump to content

Help:Custom namespaces: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
Uncle G (talk | contribs)
Changed to system admin TOC.
better integration of Mediawiki 1.5.x examples; cleaned up indentation
Line 5: Line 5:


#Pick the names of your namespace and its talk page. Also pick numbers.
#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'')
#:''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'')
#Goto /includes/DefaultSettings.php and copy the variables <var>$wgExtraNamespaces</var>, <var>$wgNamespacesWithSubpages</var>, and <var>$wgNamespacesToBeSearchedDefault</var> into LocalSettings.php
#Goto /includes/DefaultSettings.php and copy the variables <var>$wgExtraNamespaces</var>, <var>$wgNamespacesWithSubpages</var>, and <var>$wgNamespacesToBeSearchedDefault</var> 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 [http://www.mediawiki.org/ current release], as there have been both bug fixes and some security fixes since then.'''
#:'''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 [http://www.mediawiki.org/ current release], as there have been both bug fixes and some security fixes since then.'''
Line 14: Line 14:
101 => "Foo_Talk");
101 => "Foo_Talk");
#If you want [[sub pages]], add it to <var>$wgNamespacesWithSubpages</var>
#If you want [[sub pages]], add it to <var>$wgNamespacesWithSubpages</var>
#*:Example:
::*Example for MediaWiki 1.4.x and older:
$wgNamespacesWithSubpages =
$wgNamespacesWithSubpages =
array( -1 => 0, 0 => 0, 1 => 1, 2 => 1, 3 => 1,
array( -1 => 0, 0 => 0, 1 => 1, 2 => 1, 3 => 1,
Line 20: Line 20:
8 => 0, 9 => 1, 10 => 0,11 => 1,
8 => 0, 9 => 1, 10 => 0,11 => 1,
'''100 => 1, 101 => 1''' );
'''100 => 1, 101 => 1''' );
::*Example for MediaWiki 1.5.x:
#If you want the new namespace (or its talk page) searched by default, set <var>$wgNamespacesToBeSearchedDefault</var>
#*: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(
$wgNamespacesWithSubpages = array(
NS_TALK => true,
NS_TALK => true,
Line 45: Line 30:
NS_TEMPLATE_TALK => true,
NS_TEMPLATE_TALK => true,
NS_HELP_TALK => true,
NS_HELP_TALK => true,
NS_CATEGORY_TALK => true
NS_CATEGORY_TALK => true,
100 => true,
101 => true
);
);


#If you want the new namespace (or its talk page) searched by default, set <var>$wgNamespacesToBeSearchedDefault</var>
$wgNamespacesToBeSearchedDefault = array(
::*Example for MediaWiki 1.4.x and older:
NS_MAIN => true,
$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''' );

::*Example for MediaWiki 1.5.x:
$wgNamespacesToBeSearchedDefault = array( -1 => 0, NS_MAIN => 1, NS_USER => 0,
NS_USER_TALK => 0, NS_PROJECT_TALK => 0, NS_IMAGE_TALK => 0,
NS_IMAGE_TALK => 0, NS_TEMPLATE_TALK => 0, NS_HELP_TALK => 0,
NS_CATEGORY_TALK => 0,
100 => 1, 102 => 1 );


Note: Other pages for further Namespaces information:
=== Further information on Namespaces ===
Other pages for further Namespaces information:
* http://meta.wikimedia.org/wiki/Sub_pages
* http://meta.wikimedia.org/wiki/Sub_pages
* http://meta.wikimedia.org/wiki/Help:Namespace#List_of_namespaces
* http://meta.wikimedia.org/wiki/Help:Namespace#List_of_namespaces

Revision as of 16:06, 22 January 2006

For information on custom namespaces on the Meta-Wiki, see m: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)
  2. 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.
  3. 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 for MediaWiki 1.4.x and older:
$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 );
  • Example for MediaWiki 1.5.x:
$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,
 	100               => true,
 	101               => true
);
  1. If you want the new namespace (or its talk page) searched by default, set $wgNamespacesToBeSearchedDefault
  • Example for MediaWiki 1.4.x and older:
$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 );
  • Example for MediaWiki 1.5.x:
$wgNamespacesToBeSearchedDefault = array( -1 => 0, NS_MAIN => 1, NS_USER => 0,
  NS_USER_TALK => 0, NS_PROJECT_TALK => 0, NS_IMAGE_TALK => 0, 
  NS_IMAGE_TALK => 0, NS_TEMPLATE_TALK => 0, NS_HELP_TALK => 0, 
  NS_CATEGORY_TALK => 0, 
  100 => 1, 102 => 1 );

Further information on Namespaces

Other pages for further Namespaces information: