Manual talk:Using custom namespaces

Messed up??
Please help!!! I think I messed up, and forgot to give numbers to a new name-space, then moved a top-page and tried to make some changes..!!

Is there a way to rebuild the NS again, that is all articles seems to be there - but I can not edit from the top fan. (Running version 	1.12.0 !!) --Asset 19:58, 5 October 2011 (UTC)

ANYONE - please help, we are setting up a new Wiki. Can I somehow export from version 1.12 and then import to the new version? I use only very "primitive" functions so I guess that nothing in the source is changed..... --Asset 11:59, 6 October 2011 (UTC)

Could I use ExtraNamespaces in Chinese
Please see Manual_talk:LocalSettings.php.

Move conflicting pages
What is meant with "un-comment"?

comment is to include // at the start if the line un-comment is to remove // from the start of the line --Gamingmadness 05:43, 21 January 2008 (UTC)

Problem with "Special:Wantedpages" after adding Custom Namespaces
After I added some custom namespaces and ran the maintenance script mentioned in this article to move existing pages into respective namespaces, almost all of the affected pages show up in the "Wanted Pages" special page. If I click on them it takes me to the edit window with the existing contents of the page. Does someone know what I am missing here?

enable extra namespace by default
Adding $wgNamespacesToBeSearchedDefault[XXX] = true; where XXX is your NS number to my localsettings file and it worked great.

if i search something i always have to enable the ns...is there a way to do that by default!? like the main ns!? thanks for help

Moonlight 11:22, 8 November 2007 (UTC)


 * If you mean you always have to click on it when you are searching, I think you have to set Manual:$wgNamespacesToBeSearchedDefault SPQRobin 15:42, 8 November 2007 (UTC)

How to set up alias names for custom namespaces
Could it be possible to set Chinese alias names for custom namespaces and use them when I use Mediawiki with Chinese user interface. --Roc michael 10:33, 21 November 2007 (UTC)

Content namespaces

 * I found that in MW 1.10.0 the updateArticleCount.php script didn't accurately update these stats (it updated the first custom NS, not all that were put into the $wgContentNamespaces array. The fix was to instead run initStats.php --update, which worked properly. Paul-lmi 17:39, 21 July 2007 (UTC)
 * Same experience here with MW 1.8.5. -- oKto siTe -  talk  16:50, 3 September 2007 (UTC)
 * Does this imply we have to run this each time we add namespaces? each time an article is added to anything but the first custom namespace?  how often does initStats get run on the default namespaces?  - Oo.et.oO 14:49, 15 August 2008 (UTC)

Category Index with Custom Namespaces
After creating couple of pages with a name prefix of "CompDB:..." I figured that those pages are all shown under "C" in a category index. Obviously because they are part of the Main namespace. Thus I created a custom namespace CompDB and migrated all existing pages with maintance/namespaceDupes.php as suggested.

However, the category index didn't change and is still sorting all pages under letter "C" rather than the actual page name after the namespace prefix. Any hints?


 * Look at Manual:$wgCategoryPrefixedDefaultSortkey. Had the same issue and searched a long time until i found the option. However, it will be removed in 1.17.0 and default to no include of namespaces in sort keys of categories. But until 1.17.0 it works for me. Don't forget to run maintenance/refreshLinks.php afterwards.

Custom namespaces and orphaned pages
I created a custom namespace called Manual:, and since then a few pages have become orphaned (no links pointing to them). I checked the page's 'what links here' to make sure nothing linked to them. But when I went to Special:Lonelypages, the page wasn't listed. What's the catch? --CodeCat 23:24, 16 January 2008 (UTC)

help :: does not work
I Created a custom namespace 'Service' and would like all login users to edit the page. However, I would like to block editing for all the other namespaces.

define("NS_SERVICE",100); define("NS_SERVICE_TALK",101); $wgExtraNamespaces[NS_SERVICE] = "Service"; $wgExtraNamespaces[NS_SERVICE_TALK] = "Service_talk";

$wgGroupPermissions['user' ]['edit']           = false;

$wgNamesspaceProtection[100] = array('editservice'); $wgGroupPermissions['user']['editservice'] = true;

However all the page are locked for editing. Any suggession will be helpful (wiki version 1.10) Thanks


 * Found this me too.
 * It seems that the Manual has an inconsistency in giving the syntax for the permission to be set and its automapping to action


 * for example here Manual:Using_custom_namespaces suggested syntax for custom action automapped to edit


 * $wgNamespaceProtection[NS_FOO] = array( 'editfoo' ); #permission "editfoo" required to edit the foo namespace


 * while here Manual:$wgNamespaceProtection it is suggested:


 * $wgNamespaceProtection[NS_OFFICIAL]     = array( 'official-edit' );


 * Sadly, none of these WFM...

a function for adding namespaces
function namespaceAdd($name) { global $wgExtraNamespaces,$wgContentNamespaces; # create wgExtraNamespaces if it doesn't exist (first time in here): if (!isset($wgExtraNamespaces)) { $wgExtraNamespaces[100] = ${name}; $wgExtraNamespaces[101] = "${name}_talk"; } else { array_push($wgExtraNamespaces,${name},"${name}_talk"); }       $wgContentNamespaces[] = sizeof($wgExtraNamespaces)-1; } This seems to work, even though i cheated and used "global". but i don't really know how to debug stuff in LocalSettings.php. It adds the extra namespaces starting at 100, adds the talk namespace and adds the namespace (not the talk namespace) to the Content Namespaces so they get counted in the wiki's stats.

so just add the code above to your LocalSettings.php then below it do: namespaceAdd("new namespace");

Oo.et.oO 18:18, 15 August 2008 (UTC)

namespaces vs. categories vs. groups
What is the actual differences between categories, name spaces and groups? Idea: Please extend editors help pages with more about this? Asset
 * I don't know, what groups are, but categories are similar to tags (assign one page to one or more topics), namespaces are more like drawers (one namespace per page). --Flominator 17:37, 14 July 2008 (UTC)


 * Well one difference is that the namespace is setup by the owner/administrator of the wiki. Categories are made by editors. - however, what I ask here is for someone to add this information at the popper place.
 * Which would be where? It's a wiki :) --Flominator 19:29, 14 July 2008 (UTC)
 * :) correct, anyway I suggest that there should be an implicit "intention to port advice to documentation"?

actual use
note: all the answers below can be found relatively easily by searching in google or in meta or here.

I miss some introduction to:
 * How to add a page to a namespace
 * just like any other page, only add the namespace and a colon before the name: Talk:talk namespace page. Oo.et.oO 15:11, 15 August 2008 (UTC)
 * How to see what namespaces there are
 * special:allpages look in the dropdown box is one way Oo.et.oO 15:11, 15 August 2008 (UTC)
 * What actually happens when I add a name space and changes the name of an index, say 100/101, to something else.
 * you mean how do you change the name of a namespace? change the name in LocalSettings.php and if the number assigned to the namespace remains the same (implied your first custom namespace here (100)) then the pages will "follow". Oo.et.oO 15:11, 15 August 2008 (UTC)
 * Is there a way to see pages that are defined as if they are namesubpages
 * pages in namespaces can have subpages if allowed in LocalSettings Oo.et.oO 15:11, 15 August 2008 (UTC)
 * Could I add some "tag" to a page telling that this is actually a page in an namespace
 * you can use some magicwords to find the name of the current namespace. also there are some template variables to do this. Oo.et.oO 15:11, 15 August 2008 (UTC)

Tied to add my name space [MO:Page Name], but how can I see that this group is actually seen as part of that namespace?? Asset

Userrights for Namespaces
Which Userrights can be used for an namespace? Is it only edit, read or can I use thinks like search or createpage?

--Fightgnome 13:03, 30 December 2008 (UTC)

Strange behaviour
I'm using Mediawiki 1.13

I added 2 custom namespaces:

define("NS_DRAFT", 100); define("NS_DRAFT_TALK", 101);

$wgExtraNamespaces[100] = "Bozze"; $wgExtraNamespaces[101] = "Discussioni Bozze";

For my "Draft" pages, but the relation page/talk page seems not to work as intended.


 * if I click on a "Bozze:Foo"'s discussion tag, I'm brought to a REGULAR page, without the "+" tab for adding new discussions.
 * the "Discussioni "Bozze:Foo" itself has a discussion tag ,which brings me to a "Discussioni:Discussioni Bozze:Foo" page, which is a regular discussion page.
 * if i save that "Discussioni Bozze:Foo", the discussion tag still is rendered in red, as if the page dose not exist.

Is this a bug or did I do something wrong?
 * Hi there, you need to use $wgExtraNamespaces[101] = "Discussioni_Bozze"; with an underscore (_) instead of a whitespace in namespace names.--Mrmryrwrk&#39; 17:20, 24 February 2010 (UTC).

Allocation of articles to namespaces fails
Hello @ all,

some weeks ago, I defined some customized namespaces and everything worked fine. But now I have a problem: Let's say one namespace I recently defined is called "NewNamespace". Now I want to create a new article within this namespace, let's say "NewNamespace:HelloWorld". Then what happens is, that the new article is stored in the (Main) namespace with title "NewNamespace:HelloWorld", but not in the "NewNamespace". The strange thing about it is, that the articles which are already in the "NewNamespace" still work fine, so I don't think that it's a problem with the namespace definition. Can anyone help me? Does anyone have an explanation for this?

PS: I checked about a hundred times that I don't have any typing errors within the article's name, so this easiest explanation drops out as well.

use ä ö ü ß in custom namespaces
Hello

i want customize my own wiki by using ä ö ü ß in custom namespaces

Perhaps i want define: $wgExtraNamespaces[102] = "Hebräische_Sprache"; $wgExtraNamespaces[103] = "Hebräisch Besprechung";

but, if i save localconfig.php the wiki will display: "Hebr-black?-ische Sprache" if i use UTF-8 code in localconfig i have no sucsess

--Україна 16:06, 31 July 2009 (UTC)

Changing css/stylesheet for custom namespace
Can I change the default css/stylesheet for a custom namespace? ~Rohit


 * The namespace id is included as a class to the body tag of every page, e.g.  . You can use this information to style each namespace individually. hth --Nakohdo 13:08, 11 October 2011 (UTC)

Namespaces > 999
The custom protected namespaces that we have implemented are assigned to NS numbers greater than 1000. In doing this we had to make a slight modification to the NSFileRepo.php file, lines 268 and 269. Is there any forseable issue in using namespaces greater than 999? Feedback would be much appreciated.

--Dgennaro 19:47, 2 April 2010 (UTC)

Removing a namespace (and moving all content beforehand)
i'm trying to do some reorganization of our namespaces, including removing some. My problem is that when i comment out the namespace in LocalSettings.php, the pages actually disappear from the wiki. What i want is to have the pages exist, but not be in an official namespace anymore. I can't seem to find a way to do this. Zeefreak 16:32, 10 October 2011 (UTC)


 * Every wiki pages has to be in a namespace. Pages without explicit namespace always belong to namespace Main. You should move (rename) all your pages before deactivating the namespace in localsettings. hth --Nakohdo 13:05, 11 October 2011 (UTC)


 * i guess this is part of my problem. one of my namespaces has over a thousand pages in it. renaming them all is pretty much not an option. what i don't quite understand is if someone names a page something:foo, and 'something' isn't defined as a namespace, that page is technically in the main namespace. if i then enable namespace 'something' that page disappears. conversely if a namespace exists and pages in it also exist, and i disable the namespace, they all disappear.


 * i guess this has something to do with the way namespaces are implemented via id instead of actual name. the question i have here is how to i migrate pages in a namespace into the main namespace so when i disable the namespace they exist. i found a maintenance script in my searching yesterday maintenance/namespaceDupes.php but it seems to stop due to two conflicts i have in the main namespace. Zeefreak 13:50, 11 October 2011 (UTC)


 * Better try Manual:MoveBatch.php . You can use Extension:DynamicPageList (third-party) for creating a list of all pages of a certain namespace. --Nakohdo 14:24, 11 October 2011 (UTC)

How to rename Project namespace
How can I rename our Project namespace and what we have to note? --Speedtook 12:18, 25 January 2012 (UTC)


 * If you haven't created any content yet in your namespace just create the new one and forget about the old ;-) If there's already content then see the section above about removing namespaces and moving all its content beforehand. hth --Nakohdo 17:21, 26 January 2012 (UTC)

Custom namespaces in extensions
This code example might help when trying to register custom namespaces in an extension :

Red links but still working
$wgExtraNamespaces[500] = "Walkthrough"; $wgExtraNamespaces[501] = "Walkthrough_talk"; $wgNamespacesWithSubpages[500] = true; This is what I have added. Now, there were pages using Walkthrough:xxx before I added those, making them still a part of mainspace. After I added the namespaces, these pages vanished. I reverted my changes and had the pages moved under a different name, added the namespaces again and moved the pages back to their original Walkthrough:xxx name. Now these pages appear as redlinks, however, they still work. This problem only exists with pages that were named Walkthrough:xxx before I added the namespaces, using a different name than the original, makes a blue link.
 * 1) Add namespaces

Walkthrough:xxx

I add namespaces

Walkthrough:xxx (page does not exist, it vanished)

I undo my changes to LocalSettings.php, removing the namespaces

Walkthrough:xxx (works normally)

Walkthrough:xxx moved to xxx

I re-add the namespaces

xxx moved to Walkthrough:xxx, but it's a red link, but it still works

Walkthrough:xxx moved to walkthrough:yyy (works normally)

Moved back to Walkthrough:xxx, and it again appears as a red link, but it still works.

I have tried purging caches and all, it has no effect whatsoever.

--Sovereign92 (talk) 15:51, 5 September 2012 (UTC)


 * Looks likethey only show as red links in logs and RC, they show blue in the Walkthrough category. --Sovereign92 (talk) 15:57, 5 September 2012 (UTC)

I'mma confuddled about namespace order
I'd like the namespaces I made up for my project, namely Glitch: and Glitch talk: to be right next to each other in the list on the logs / recent changes page. (see screenshot http://prntscr.com/59ez7l ) Is there any effective way to do this? 20:18, 23 November 2014 (UTC)

Is it possible your namespace IDs for the Glitch and Glitch_talk namespaces are not sequential? --JosefAssad (talk) 14:10, 16 April 2015 (UTC)

Would index 500 in examples be better as 3000?
Since Extension_default_namespaces suggests leaving 3000+ free while 500-599 is occupied, perhaps it would be better to suggest 3000+ and use it in the examples. Also, Extension_default_namespaces (and here) should perhaps suggest 3000-3999. PJTraill (talk) 22:19, 27 January 2015 (UTC)

Cannot set up group permissions for my custom namespace
Here's hoping someone can help me out here. I have a custom namespace that works fine, set up just like all the manuals and other documentation I could find on mediawiki said it should be set up. However, no matter what I do, I cannot set up group permissions to only let certain people edit those pages. I can set up group permissions for only specific groups to edit ALL pages, but trying to limit them to the custom namespace means they have no edit rights to any pages. I have tried everything it says anywhere in this manual and am stuck. Any help would be GREATLY appreciated. Info that might help is below:

The group is called "wledit" and the namespace is "WL"

Product	Version MediaWiki	1.15.1 PHP	5.3.0 (apache2handler) MySQL	5.1.39-community-log

Some snippets of LocalSettings.php // Prevent anonymous users from editing $wgGroupPermissions['*']['edit'] = false; $wgGroupPermissions['*']['createpage'] = false; $wgGroupPermissions['*']['createtalk'] = false;

$wgGroupPermissions['*']['read'] = false; $wgGroupPermissions['user' ]['read'] = false; $wgGroupPermissions['confirmed']['read'] = true; //allows just confirmed people to read stuff $wgGroupPermissions['coedit']['read'] = true; $wgGroupPermissions['wledit']['read'] = true;

...

define("NS_WL", 520);                                 //defines WL name space define("NS_WL_TALK", 521); $wgExtraNamespaces = array(520 => "WL",             521 => "WL_talk",             );
 * 1) Assigning the Namespace for World Languages pages

//$wgNamespaceProtection[NS_WL] = array( 'editWL' );
 * 1) maybe this is the problem?? 9/11/2015

// Allow WL editors to do more stuff like edit and create pages $wgNamespaceProtection[NS_WL] = array( 'wl-edit' ); $wgNamespaceProtection[NS_WL_TALK] = array( 'wl-talk-edit' ); $wgNamespacesWithSubpages[NS_WL] = true;           //subpages enabled for the WL namespace

//does this? $wgGroupPermissions['sysop']['wl-edit'] = true;     //permission "editWL" granted to users in the "sysop" group $wgGroupPermissions['bureaucrat']['wl-edit'] = true;     //permission "editWL" granted to users in the "sysop" group $wgGroupPermissions['admin']['wl-edit'] = true;     //permission "editWL" granted to users in the "sysop" group $wgGroupPermissions['wledit']['wl-edit'] = true;     //permission "editWL" granted to users in the "sysop" group $wgGroupPermissions['wledit']['wl-talk-edit'] = true; //employees can edit pages in the Official_talk namespace

// Allow co-editors to do more stuff like edit and create pages $wgGroupPermissions['wledit']['wl-move'] = true; $wgGroupPermissions['wledit']['wl-edit'] = true; $wgGroupPermissions['wledit']['wl-editarticles'] = true; $wgGroupPermissions['wledit']['wl-createpage'] = true; $wgGroupPermissions['wledit']['wl-createtalk'] = true; $wgGroupPermissions['wledit']['wl-upload'] = true; $wgGroupPermissions['wledit']['wl-reupload'] = true; $wgGroupPermissions['wledit']['wl-reupload-shared'] = false; $wgGroupPermissions['wledit']['wl-minoredit'] = true; $wgGroupPermissions['wledit']['wl-delete'] = false;

$wgNamespacesToBeSearchedDefault[NS_WL] = true;

$wgNamespacesToBeSearchedDefault = array(       NS_MAIN =>           true,        NS_TALK =>           false,        NS_USER =>           false,        NS_USER_TALK =>      false,        NS_PROJECT =>      false,        NS_PROJECT_TALK => false,        NS_IMAGE =>          false,        NS_IMAGE_TALK =>     false,        NS_MEDIAWIKI =>      false,        NS_MEDIAWIKI_TALK => false,        NS_TEMPLATE =>       false,        NS_TEMPLATE_TALK =>  false,        NS_HELP =>           false,        NS_HELP_TALK =>      false,        NS_CATEGORY =>       false,        NS_CATEGORY_TALK =>  false,        NS_WL =>           true, );
 * 1) Set default searching

$wgContentNamespaces[] = NS_WL; //should mean that things that are in the proprietary namespace are counted as articles

Dead link under "Removing custom namespaces"
While translating the page, I found the link under "Removing custom namespaces" pointing to a mailing list thread is dead. An archived version exists, but can I just replace it in the English page? Or will this break havoc for translations anyhow? --Tactica amiga (talk) 22:34, 30 April 2016 (UTC)

Spaces break extensions.
Copying and modifying the following code (changing only the names)

broke my wiki. But replacing the spaces, allowed custom namespaces and didn't break every extension on my wiki.

19:32, 16 February 2021 (UTC)