DokuWiki - Wiki backends for documentation

If you have a few webpages you maintain, something like Dreamweaver is good enough. But once you get to a couple -hundred- tutorials/projects/documents with multiple collaborators you have to take a good hard look at how you manage content. Around this time, most people end up using something like Drupal or another Content Management System (CMS). I'm sort of an old skooler - I like the idea of CMS but I hate the look of 'em. They all have this kinda gross 'man page' look. Very utilitarian but not particularly easy to navigate.

Since I already had a lot of content in raw HTML, I wanted to move it all over without a lot of nonsense. I like the idea of a wiki but dont want it to be too obviously a wiki. Blogs are good but too temporal, and it isn't easy to collaborate on a single post. I don't want comments on tutorials, but I'm OK with people making minor text corrections. There's probably some awesome solution to all this but well I couldnt figure out so I decided to go with a wiki backend to a Dreamweaver template. It's not going to be what we use forever but it's a pretty good start.

Which Wiki?

I ended up with DokuWiki - it's designed for documentation, has a fairly good ACL (access control system), and uses a file system database (not a mysql database). Other wiki systems might be great. My view is that they are all terrible to edit, really.

If someone knows of a good WYSIWYG editor for wikis, that would rock because right now nothin' out there is looking very good.

Pulling Wiki HTML

Having an editable page but without having all the 'edit decoration' means that while there is a wiki behind this page, you don't see it. Instead, I pull the pre-rendered (cached) HTML using a very minimal PHP script in the wiki directory:
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__)).'/');

//import variables
$QUERY = trim($_REQUEST['id']);
$ID = getID();

$REV = $_REQUEST['rev'];
$HIGH = $_REQUEST['s'];
if(empty($HIGH)) $HIGH = getGoogleQuery();

//sanitize revision
$REV = preg_replace('/[^0-9]/','',$REV);

$html = p_wiki_xhtml($ID,$REV,true);
$html = addslashes($html);
$html = ereg_replace("\n", '\n'."\\\n", $html);
$html = str_replace("</a>", "</a> ", $html);

echo ('var zoomy = "'.$html.'";');
echo ("document.write(zoomy);");

$url = "" . str_replace(':', '/', $_REQUEST['id']);
$footer = '<hr /><br /><em>This page was autogenerated from <a href=\"'.$url.'\" target=\"_blank\">' . $url . '</a> <br 
/>Please edit the wiki to contribute any updates or corrections.</em>';

$footer = '"' . $footer . '"';
echo ('document.write('. $footer . ')');
It's then trivial to 'include' a wiki page by adding into an HTML file. It will even make a cute little footer (as you can see below). You might need to fix up your CSS to manage how it looks but that's pretty much it.

The other nice thing about having content in a wiki is it's so easy to 'readapt' it - the markup is nearly universal and it's easy to parse even if you have to say convert it to XML. There's also a nice revision control system that's 'built into' the wiki - easy to undo spammer effects and also look at old versions if necessary.

This guide was first published on Feb 27, 2013. It was last updated on Mar 08, 2024.

This page (Wiki) was last updated on Feb 20, 2013.

Text editor powered by tinymce.