MediaWiki - CMS |
4.8 Namespaces |
15.06.2007 |
| ← 4.7 Error Messages (Hints) | [ up ] - [ A - Z ] - [ top ] | 4.9 Footnotes / Publishing → |
I could not figure out how this stuff works or even what a namespace is good for :-|
There is a function getNamespaces() available with that you could possibly do clever things.
If you had a good reference let me know.
27.09.2006 RS: Meanwhile I could find a usage for hide some specific pages from the public. I could add a minor if clause into includes/OutputPage.php to show specific pages only to logged in users. See at the bottom of this page.
--reto
Add your own custom namespace
- Edit includes/DefaultSettings.php
/** Which namespaces should support subpages? * See Language.php for a list of namespaces. */ $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, NS_FOOBAR => true ); $wgNamespacesToBeSearchedDefault = array( NS_MAIN => true, );→ files/defaultsettings 1 7 1 patch.txt
- Edit languages/Language.php
/* private */ $wgNamespaceNamesEn = array( NS_MEDIA => 'Media', NS_SPECIAL => 'Special', NS_MAIN => '', NS_TALK => 'Talk', NS_USER => 'User', NS_USER_TALK => 'User_talk', NS_PROJECT => $wgMetaNamespace, NS_PROJECT_TALK => $wgMetaNamespace . '_talk', NS_IMAGE => 'Image', NS_IMAGE_TALK => 'Image_talk', NS_MEDIAWIKI => 'MediaWiki', NS_MEDIAWIKI_TALK => 'MediaWiki_talk', NS_TEMPLATE => 'Template', NS_TEMPLATE_TALK => 'Template_talk', NS_HELP => 'Help', NS_HELP_TALK => 'Help_talk', NS_CATEGORY => 'Category', NS_CATEGORY_TALK => 'Category_talk', NS_FOOBAR => 'Foo_bar', );
- vi includes/Defines.php
Number 100 and beyond are reserved for custom namespaces;
DO NOT assign standard namespaces at 100 or beyond.
DO NOT Change integer values as they are most probably hardcoded everywhere
... define('NS_FOOBAR', 16);
Try → meta.wikimedia.org/wiki/MediaWiki_namespace↑
Hide specific pages from users not logged in
00000480: function output()
[root@quartus includes]# diff OutputPage.php bak/OutputPage_orig.php 485,494d484 < # -- XX: < global $wgTitle, $wgTitle; < if ($wgTitle->getNamespace() == 16 && $wgUser->getID() == 0) { < header( 'Location: ' . < "../index.php?title=Special:Userlogin&returnto=" . < $this->getPageTitle() ); < return; < } < # -- /XX <
A related error message might be nicer than to rediret to the login page. At least, you will have a link to return to the wanted page. Maybe it would work smth with this:
OutputPage.php: $this->fatalError( wfMsg( 'filecopyerror', $old, $new ) );
Please let me know if you had a recipe. --reto
See also:
- meta.wikimedia.org/wiki/MediaWiki_namespace↑
- Know-how: MediaWiki Namespaces
- Reference
Namespaces: Hide or protect specific pages from not logged in users.
infocopter.com/know-how/mediawiki-reference/namespaces.html
- Know-how: Mediawiki Skin How to
- Reference
How to create / customize skins
blog.var.cc/docs/Mediawiki_Skin_Howto.html
- Know-how: MediaWiki
- Reference
Namespaces
simple.wikipedia.org/wiki/Wikipedia:MediaWiki_namespace
← 4.7 Error Messages (Hints)
A - Z Index
Top
Disclaimer
4.9 Footnotes / Publishing →
$Id: namespaces.html,v 1.80 2007/06/15 11:49:14 webcms Exp $
copyright © 2005-2007 by reto