One of the things I’ve been meaning to add to my Mediawiki powered wiki is an Infobox.
Having done some research into I struggled to find a good guide to get me up and running from scratch so I decided to write one as I figure things out for myself!
If you want to install a Mediawiki Infobox then this tutorial will tell you everything you need to know to get going.
How to add a Mediawiki Infobox
The first article I recommend reading is the Wikipedia Infobox page. It’s useful to see the history of how they evolved and what they should and shouldn’t be used for.
That said, one good thing about hosting your own wiki is that you don’t have the wiki police on your back telling you what you can and can’t do!
1) Install the Parser Extension: This is required to allow logical functions in your wiki text. This Infobox implementation requires the extension to parse the relevant templates. This functiaonlity allows you to do all kinds of operations from basic arithmetic to complex logical statements. You can read more here.
Installation is standard:
- Upload the files to your extension folder
- Add the following to your LocalSettings.php:
require_once( “$IP/extensions/ParserFunctions/ParserFunctions.php” );
2) Common.css: The common.css file contains styles common across all skins. The code you add into this page will be used to stlye any Infobox that you create.
- Locate and example on an established Wiki site, for example Wikipedia.
- Copy the CSS code.
- Navigate to /wiki/MediaWiki:Common.css
- Paste and hit save!
3) Create Templates: The Wiki Infobox is made up of a number of templates, but don’t worry you can go grab these from another MediaWiki powered site. I went for good old Wikipedia!
The Wiki engine has the ability to import and export pages via XML which makes this whole process a cinch! When you export a page, you have the option to include all associated templates at the same time. So when you do the import you bring through all the required pages:
- Locate the page you wish to export and use the Special export page to create an XML file containing all of the templates you require.
- You should get a file that looks like this.
- You can then import this XML file through your own Import Special page, you will find this at the following location: yoursitehere.com/wiki/Special:Import
Note: If you search for how to add infoboxes on Google you might come across an old guide that suggests adding each template by hand – you really don’t need to do it that way, the import / export method is easier and far more likely to ensure you get all the templates you need.
For more information on templates and infoboxes, check out the following links: