Manual talk:$wgNamespacesWithSubpages
Add topicExample to get this working
[edit]ftp down your LocalSettings.php file
add the following 2 lines of code:
$wgExtraNamespaces = array(100 => "YOURNAMESPACE", 101 => "YOURNAMESPACE_talk"); $wgNamespacesWithSubpages[100] = true;
upload the LocalSettings.php file
create the following as the parent page name: YOURNAMESPACE:Home
then create the following as a childpage name: YOURNAMESPACE:Home/Child1
this will embed a simple < YOURNAMESPACE:Home link at the top of the child. Unfortunately, the page name is mucked up with the namespace, colon, parent, and slash.
Problems with subpages in the main namespace
[edit]site: wikademia.org -> subpages are not working in main namespace... some sort of error. If you take a look and can tell me how to fix it, then 1000 thanks. Thanks.
- I don't see any errors. —Emufarmers(T|C) 11:02, 4 April 2009 (UTC)
- http://wikademia.org/Scratch_9/Test goes to missing.html ... subpages do work in user space and other namespaces, like at http://wikademia.org/Meta:Scratch/Scratch ...
- I would guess you have a rewrite rule that doesn't always allow for slashes in titles. —Emufarmers(T|C) 02:32, 5 April 2009 (UTC)
- in .htaccess? I don't even see a .htaccess ... or somewhere else?
Disable subpages for all namespaces
[edit]Hello, will this directive disable subpages for all namespaces?
$wgNamespacesWithSubpages = array();
--89.185.250.132 16:04, 6 June 2010 (UTC)
- It should. --Bachsau 10:44, 8 July 2010 (UTC)
?
[edit]# Enable subpages in the main namespace $wgNamespacesWithSubpages[NS_MAIN] = true;
Nothing in mediawiki 1.6.
Why disable by default?
[edit]Why are most of the core (non-talk) namespaces disabled by default? Wikipedia has most of them enabled. And the only reason they disable it for the mainspace is for encyclopedia structure. For a general-purpose wiki I see even less of a reason to disable subpages. 65.87.26.122 01:23, 29 February 2012 (UTC)
- The distinction dates back to pre r1284 which is the dark ages. Back in those days, mediawiki's default config much more reflected how things were wanted on wikipedia instead of wikipedia having custom config in cases where they wanted weird things. Thus I'd guess its mostly for historical reasons, and no one has ever changed it. Bawolff (talk) 04:02, 29 February 2012 (UTC)
From what I can tell from InitialiseSettings.php, it's usually:
$wgNamespacesWithSubpages = array(
NS_MAIN => false, // False as MW default and on all WMF wikis except Wikisource, Wikiversity, ArbCom, etc.
NS_TALK => true, // True as MW default and on all WMF wikis
NS_USER => true, // True as MW default and on all WMF wikis
NS_USER_TALK => true, // True as MW default and on all WMF wikis
NS_PROJECT => true, // False as MW default, but almost every WMF wiki sets it to true
NS_PROJECT_TALK => true, // True as MW default and on all WMF wikis
NS_IMAGE => false, // False as MW default and on all WMF wikis
NS_IMAGE_TALK => true, // True as MW default and on all WMF wikis
NS_MEDIAWIKI => false, // False as MW default and on almost all WMF wikis
NS_MEDIAWIKI_TALK => true, // True as MW default and on all WMF wikis
NS_TEMPLATE => true, // True as MW default and on most major WMF wikis
NS_TEMPLATE_TALK => true, // True as MW default and on all WMF wikis
NS_HELP => true, // False as MW default but true on almost all WMF wikis
NS_HELP_TALK => true, // True as MW default and on all WMF wikis
NS_CATEGORY => false, // False as MW default and on most WMF wikis
NS_CATEGORY_TALK => true, // True as MW default and on almost all WMF wikis
// Everything above 100 is usually true
);
It looks to me like NS_PROJECT and NS_HELP would be good candidates for a default setting of true. So, I have filed it as bugzilla:42004. Leucosticte (talk) 09:45, 11 November 2012 (UTC)
No more than 200 namespaces OR no namespace with an index greater than 200?
[edit]# Enable subpages in all namespaces
$wgNamespacesWithSubpages = array_fill( 0, 200, true );
The above example of how to go about enabling this for all namespaces claims, "This assumes you have no more than 200 namespaces." Is it accurate to say "no more than 200 namespaces" OR would "no namespace with an index greater than 200" be more accurate? I ask because although we only have 21 namespaces on our wiki, we have one with an index of 500 (501 for talk). -- Thanks, ShoeMaker ( Contributions • Message ) 16:48, 13 February 2013 (UTC)
consequences of disabling after having it be enabled
[edit]I want to disable the feature of $wgNamespacesWithSubpages so that it will not apply one of my nav templates to subpages. I am worried that it will have more of an effect on my wiki then I care to deal with. Are there any major consequences/issues that will occur if i disable $wgNamespacesWithSubpages after having it be enabled for the entires wiki's life?
- I guess that with "disabling $wgNamespacesWithSubpages" you mean that you want to set it to an empty array.
- That would have the effect that you cannot create subpages in any namespace. The question then is what then happens with those subpages that already are there? I guess (unchecked) that they are not immediately deleted *sigh* only because you set that value. However, what I could imagine is that you might then have problems editing them. To be on the save side, I would first move all subpages to a place, which also is valid after disabling $wgNamespacesWithSubpages by setting it to an empty array. Meaning: Move them so that they no longer are subpages and then disable $wgNamespacesWithSubpages. --88.130.107.208 10:14, 22 June 2014 (UTC)
my solution
[edit]For me worked this snipplet:
$wgNamespacesWithSubpages[0]=true;
--ZweiEinsEinsFünfDrei (talk) 19:44, 16 July 2018 (UTC)