User Tools

Site Tools


tutorials:library:software:wiki.html

This is an old revision of the document!


Introduction

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 isnt 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. Its not going to be what we use forever but its a pretty good start.

Which Wiki?

I ended up with DokuWiki - its 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 dont 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__)).'/');
require_once(DOKU_INC.'inc/init.php');
require_once(DOKU_INC.'inc/common.php');
require_once(DOKU_INC.'inc/events.php');
require_once(DOKU_INC.'inc/pageutils.php');
require_once(DOKU_INC.'inc/html.php');
require_once(DOKU_INC.'inc/auth.php');
require_once(DOKU_INC.'inc/actions.php');

//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 = "http://www.ladyada.net/wiki/" . 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 . ')');
?> 

Its then trivial to 'include' a wiki page by adding <script language="Javascript" src="/wiki/show.php?id=tutorials/library/software/wiki.html"></script> 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 its so easy to 'readapt' it - the markup is nearly universal and its easy to parse even if you have to say convert it to XML.

/home/ladyada/public_html/wiki/data/attic/tutorials/library/software/wiki.html.1321827911.txt.gz · Last modified: 2016/01/28 18:05 (external edit)