Chapter 9. Extensions

By now, you are familiar with magic words and how to use them with wikitext. In this chapter, you will learn how to create your very own magic words and special pages. Of necessity, this means diving a little deeper into the inner workings of MediaWiki, and it requires familiarity with PHP. If you are completely unfamiliar with PHP and computer programming, you can find several good books that can help you.

See especially Beginning PHP, Apache, MySQL Web Development, by Michael K. Glass et al. (Wrox, 2004).

Otherwise, read on and learn about MediaWiki's extension mechanism.

Extensions enable you to customize MediaWiki to your individual needs. The MediaWiki community has made a fairly large number of extensions available, which are a good starting place to learn how to write them. Extensions are surprisingly easy to write in MediaWiki. They are made possible by a rather large collection of hooks throughout the application that you can register callback functions with, which are then called at opportune times.

XML tag extensions and parser functions are callback functions that enable you to extend wikitext. There are a large number of other hooks, though, that give you the opportunity to modify MediaWiki behavior at all stages of the page delivery process.

In addition to learning how to use hooks in this chapter, you will also learn how to create your own special pages.

MediaWiki Hooks

A hook is an array of functions (if any functions have been registered) that are ...

Get Professional Wikis now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.