A wiki for content management

Introduction

This site is managed using a wiki, namely MediaWiki, as the means to create and edit content. I have thought about this for a while and there are a number of benefits.

In addition, recently I have been using wikis in a few interesting ways ...

How this integrates with MediaWiki

Besides the classes within MediaWiki, there are no reliable Wikitext to HTML convertors written in PHP. There are parsers for Python, Perl and C++ by the looks of it. I am happier working with PHP though. The way I have done this might be useful to someone. The best way would have been to get into the MediaWiki code to create an HTML export - but that looks like a decent amount of work.

What the code is doing ...

  1. requests a page from the Wiki via HTTP which contains the list of Wiki pages to render (this page list is cached)
  2. grabs a valid content page via HTTP and removes all Wiki related parts of the page with regular expressions (including edit links and headers, footers, sidebars etc) - this is cached. The absurd nofollow that is added to links by MediaWiki is removed. Using regular expressions is a somewhat dirty way to achieve the result - but it avoids having to work with MediaWiki's code.
  3. modrewrite is used to create filenames that are nice - and requests are run through a script which pulls the cached version or a new version if it has been a while.
  4. the content is rendered using a simple template.
  5. the list of wiki pages is used to create navigation on the home page (which is kind of random) - it also handles external links (these are all stored in the main wiki page).

This is a simple solution but it will be useful for informal content creation.

Copyright © Geoff 2007 All Rights Reserved