The Trouble With Ambox (and Mbox)

So today I had a little struggle getting the Template:Ambox (and my other custom Templates going on my new Wiki site). I had this same struggle once before when building a private wiki, but I couldn't remember the details and I had to figure it all out again step-by-step.  There's really nothing more frustrating than that!  When you know you've been somewhere once before, but you really can't remember quite how you got there. So, I thought I'd document it briefly. Now, I'll preface by saying:  I'm absolutely no MediaWiki wizard here! I'm just figuring it out as I go, but I have learned a few things along the way. If some true MediaWiki warrior stumbles upon this page at some point, and I'm wrong on this in some way (or, more likely, many ways), please go ahead and throw something in the comments for me.

So, say you're running a MediaWiki server and you want one of these to show up on your pages:

Ambox Example

Or perhaps something like this:

You'll notice that Wikipedia uses these types of informational alert bars in many places (though they use them for different purposes than I usually do, since my Mediawiki use is mostly targeted at documentation).

Either way, accomplishing this on a stock Mediawiki installation is fairly simple, though if you're just starting out, the challenge can feel awfully daunting.  Those little info boxes are created using a special type of page called a Template, which can be then embedded in another wiki page (this is called "transclusion").  To learn more about Templates, visit the Mediawiki Help page for Templates.  Specifically, it is created using the Template:Ambox (which means article message box). There are a few different types of Mbox Templates including imbox (image message box), tmbox (talk page message box), and the plain vanilla mbox template (which is a sort-of "parent" to the other types of Mbox Templates).

The steps for implementing the Ambox template on your server essentially are:

  1. First, to use these templates, you will need the ParserFunctions MediaWiki Extension. This is a very versatile extension, and it will really come in handy. This is very simple to install, just follow the instructions in the link above.
  2. Copy the CSS settings needed to create and format the template into your wiki's Common.css file.  The best and most up-to-date place to get all a good "standard" setup for the Common.css file is from the MediaWiki:Common.css page.
  3. On your wiki, go to to access your Common.css file, click the edit tab, and paste the code in there.
  4. Find a source for the Ambox template and other related templates you'll need.  A good place would be Wikipedia's Template:Ambox page, of course.
  5. Export the templates using MediaWiki's Special:Export utility to an XML file.  Make sure to check the Include Templates box before you click export.  For this purpose, there's no reason to export the full history of the page.  For more assistance using the Special:Export tool, check the help documentation on the Meta-wiki.
  6. Go back to your MediaWiki server, and use the Special:Import utility to import this XML file into your server.
  7. Update the templates with needed graphics.  Open up the new Template pages one at a time after you import them.  If any of them are listed as "File:" and are red, that means you're missing a picture.  Click on the link to open the File upload page on your wiki, and then go find some appropriate graphics to use.
  8. Most of the graphics and icons used in these systems on Wikipedia can be found on the Wikimedia Commons and are licensed for you to use freely (though check the licenses if you're using them commercially).  If you can't find the exact image, you should be able to find some good stand-ins (or maybe customize them by choosing some of your own graphics).  Just search using the exact filename and you should find what you need.
  9. While the Special:Export utility does seem to recursively export some "supporting" Templates, you may find that you need to repeat steps 3-6 a few times.  After you import the new sets of Templates into your wiki, go through and open each of them up.  If you see additional Templates listed in red, then go back to Wikipedia and export those Templates as well.  Within a few iterations of doing this, you should have a working Ambox system.

When you are importing the Templates, you'll probably see that the Documentation part of your Templates is all broken (mostly due to Wikipedia's multi-language setup).  So long as you know to look at MediaWiki or Wikipedia to look up documentation for using these Templates, this isn't a big deal.  If you're feeling nit-picky, you can fix it somewhat easier by using the $wgEnableScaryTranscluding global variable in your LocalSettings.php file.  Managing the InterWiki list is made much easier using the InterWiki Extension.

Then, to use your new templates, refer to the Template:Ambox documentation on Wikipedia.  A simple example to create a "speedy" ambox like the one above, would be using the following wikitext:

 | type = speedy
 | text = '''We do not handle or support Skype audio or video calls in Multimedia Services at all.''' Please do not call or email us for assistance with this application. If you do need assistance, Skype provides substantial support resources on their site at [].

Lastly, if you've done all of this and it still doesn't quite work (particularly if you don't get the shaded inset box, but you do get the icon and the text) ... Before you pull your hair out, make sure to try forcing the page to refresh bypassing the cache.  Sometimes the browser cache will cause the changes (particularly those to the Common.css page) not to take effect immediately.  If you force the browser to refresh, you should see all of the new CSS applied to the template.  You might actually have it working correctly and not know it (it has caught me before)!

These aren't the most detailed instructions in the world, but they should get you on the right path.  Hopefully this helps someone out there, or at least helps me some time down the road when I need to do this again!