Development:One instance of MediaWiki for different sites (using namespaces)

From Olekdia Wiki
  • First create namespaces in LocalSettings.php:
define("NS_MI", 3000);
define("NS_MI_TALK", 3001);

$wgExtraNamespaces[NS_MI] = "Magic_Intuition";
$wgExtraNamespaces[NS_MI_TALK] = "Magic_Intuition_talk";
$wgNamespacesWithSubpages[NS_MI] = true;

define("NS_TP", 3010);
define("NS_TP_TALK", 3011);
$wgExtraNamespaces[NS_TP] = "Time_Planner";
$wgExtraNamespaces[NS_TP_TALK] = "Time_Planner_talk";
$wgNamespacesWithSubpages[NS_TP] = true;
$wgNamespaceAliases = array(

        'Prana_Breath' => NS_MAIN,

        'TP' => NS_TP

    );
$wgMetaNamespace = "Olekdia";
  • Next change background color for each namespace. For that edit your special mediawiki page MediaWiki:Common.css:
.ns-3000 #content, .ns-3001 #content { background-color: #f5f5ff; }
.ns-3010 #content, .ns-3011 #content { background-color: #fff5ff; }
  • Than change logo of the MediaWiki for each namespace add to MediaWiki:Common.css:
.ns-3000 #p-logo a { background-image: url(./.../wiki_resources/magic_intuition_logo.png) !important; }
.ns-3010 #p-logo a { background-image: url(./.../wiki_resources/time_planner_logo.png) !important; }
  • Remember to set a default logo for Main namespace LocalSettings.php:
$wgLogo = "$wgResourceBasePath/.../wiki_resources/prana_breath_logo.png";
  • Create pages for each namespace which will be treated as main pages for it's namespaces soon: :Wiki (Main), Time_Planner:Wiki, Magic_Intuition:Wiki
  • Change "Main page" by editing MediaWiki:Mainpage page, so our created pages will be treated as "Main pages" per namespace:
{{NAMESPACE}}:Wiki

Or next block if you use WikiTranslate extension:

Special:MyLanguage/{{NAMESPACE}}:Wiki

After this step, you also find out that click on logo will direct to main page of the current namespace.

  • If you want different page titles in browser you could edit MediaWiki:Pagetitle:
$1 - {{{{NAMESPACE}}:Namespace-title}} Wiki

And after that create pages with name Namespace-title in each namespace: Magic Intuition:Namespace-title > "Magic Intuition" (Your title tail), Namespace-title > "Prana Breath" (For Main namespace).
So you will get next title in browser:
Page name - Prana Breath Wiki - for pages from Main namespace,
Page name - Magic Intuition Wiki - for pages from Magic_Intuition namespace

  • Create sidebar, with links which leads to different places depends on current namespace. Edit MediaWiki:Sidebar for that:
* navigation
** Special:MyLanguage/{{NAMESPACE}}:Wiki|sidebar-wiki
** {{{{NAMESPACE}}:Forum-url}}|sidebar-forum
** Special:MyLanguage/{{NAMESPACE}}:Download|sidebar-download
* TOOLBOX

Create sidebar messages: MediaWiki:Sidebar-wiki > "Wiki", MediaWiki:Sidebar-forum > "Forum", MediaWiki:Sidebar-download > "Download".
So you get simple menu like this:

  • Wiki
  • Forum
  • Download

But this menu leads to different pages depends on from where it is done. Create pages: :Download, Magic_Intuition:Download, Time_Planner:Download.
Also when you refer to external link to "Forum" you need to create messages with this link: :Forum-url, Magic_Intuition:Forum-url, Time_Planner:Forum-url. In this messages put pure url to your forum.