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.
- anyone i give access to the wiki could edit this page and all changes are tracked with the versioning system of the wiki - a wiki is an great way to collaborate on content and self-document edits to content
- i find creating content with a wiki incredibly fast - creating a new page is just a matter of linking to it
- the static version that is output can be easily styled, and the static page's template can be more easily modified
- it is easy to produce uniform markup because of the text-based entry and therefore, easier to standardize style across multiple authors. Wysiwig editors give too much latitude to individual authors in many cases (colors, emoticons, blah blah). In contrast, Wikitext is still flexible and allows complex formatting, without the visual dross.
In addition, recently I have been using wikis in a few interesting ways ...
- my own notebook of thoughts, ideas and projects (this site is literally tied into part of this)
- a project collaboration tool for a database-backed website - to document aspects of functionality and create to do list and track features that will be added later
- an internal knowledgebase for my company to retain information on tasks that are repeated, solutions to problems, and to document techniques that speed up development.
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 ...
- requests a page from the Wiki via HTTP which contains the list of Wiki pages to render (this page list is cached)
- 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.
- 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.
- the content is rendered using a simple template.
- 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.