Updated Dec. 18, 2008 (notes in bold)
Recently we set up a wiki for a client as a tool for collaborative documentation. They are running the new version of Drupal, 6, which includes some changes to content types, modules and so on. In this case, the wiki content had to fit in with page, blog and other content without missing a beat.
You will need the following modules:
- Wikitools
- Filter by Node Type (new version released, configuration now found in Edit content type)
- PEAR Wiki Filter (with PEAR modules)
- TinyMCE or FCKEdit (if you wish to have a WYSIWYG editor on other content types, FCKEdit v2 now allows for visibility by content type(!))
- Diff (to compare revisions)
The first step is to create the content type that you will use for wiki pages. The basic title/body combination is generally sufficient. The second step is to create an input type using the PEAR Wiki Filter module. Installing the PEAR filter is somewhat complicated - in addition to the module, you must download the PEAR packages. In addition to the standard MediaWiki format, there are packages that support Tiki Wiki, Doku Wiki, Creole and BBCode. Once these have been installed, as per the module instructions, you should be able to create an input format that uses the PEAR filter. Alternatively, you can use flexifilter to make your own wiki filter - it includes an example filter that is similar to MediaWiki.
Now, use Filter by Node Type to limit that input type to your wiki format, and vice versa. Go to the Wikitools setup and select your wiki page content type as a wiki node type. There are a number options that you may select from here for setting up your wiki. You can also enable the diff module to give you wiki-like revision control.
There, that's it- you have wiki functionality. One additional trick that might be useful: when you enable a WYSIWYG editor like TinyMCE or FCKEditor, you can select the paths on which the editor is used. Generally these are node creation and editing pages (like /node/add/wiki). However, in Drupal 6, the edit path for nodes is generic (/node/[nid]/edit)- there is no way to select which content types will use the editor when editing a node. This is a big problem for editing wiki pages because the WYSIWYG editor adds in tags that render the wiki syntax useless. In order to get around this, we used the PHP code option for visibility with the TinyMCE editor to turn it off on wiki pages. FCKEdit v2 (still in alpha, but stable in my experience with it) allows for editor visibility by content type so that it may be turned off for wiki pages.
In FCKEdit v2, you can specify exclusions of the wiki body field using something like the following: wikipage@*.edit-body.
The following code can be used to show the TinyMCE editor in only the content types you wish - as indicated by the keys of the array called $types.
<?php
$view = FALSE;
$types = array('page' => 1, 'blog' => 1, 'forum' => 1, 'event' => 1);
if (arg(0) == 'comment') {//comment pages
$view = TRUE;
}
if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == edit) { //edit pages
$nid = arg(1);
$node = node_load(array('nid' => $nid));
$type = $node->type;
if (isset($types[$type])) {
$view = TRUE;
}
}
else if (arg(0) == 'node' && arg(1) == 'add' && isset($types[arg(2)])) { //node add pages
$view = TRUE;
}
return $view;
?>
$view = FALSE;
$types = array('page' => 1, 'blog' => 1, 'forum' => 1, 'event' => 1);
if (arg(0) == 'comment') {//comment pages
$view = TRUE;
}
if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == edit) { //edit pages
$nid = arg(1);
$node = node_load(array('nid' => $nid));
$type = $node->type;
if (isset($types[$type])) {
$view = TRUE;
}
}
else if (arg(0) == 'node' && arg(1) == 'add' && isset($types[arg(2)])) { //node add pages
$view = TRUE;
}
return $view;
?>
Thanks to this comment for a point in the right direction.
A client of ours had an ingenious idea: Adding a block to wiki editing pages that has a cheatsheet for wiki syntax. Here's some example HTML code for the block (more here- http://en.wikipedia.org/wiki/Wikipedia:Cheatsheet):
<table cellspacing="0" cellpadding="1" bordercolor="white" border="1" bgcolor="#dddddd" style="font-size: small;">
<tbody>
<tr>
<td><strong>Wiki text</strong></td>
<td><strong>Wiki result</strong></td>
</tr>
<tr>
<td><tt>''<em>italic</em>''</tt></td>
<td><em>italic</em></td>
</tr>
<tr>
<td><tt>'''<strong>bold</strong>'''</tt></td>
<td><strong>bold</strong></td>
</tr>
<tr>
<td><tt>'''''<strong><em>bold and italic</em></strong>'''''</tt></td>
<td><strong><em>bold and italic</em></strong></td>
</tr>
<tr>
<td><tt>==heading 1==<br />
===heading 2===<br />
====heading 3====<br />
=====heading 4=====<br />
======heading 5======<br />
</tt></td>
<td>Headings in different sizes</td>
</tr>
<tr>
<td><tt>* item<br />
* another item<br />
* another bulleted item</tt></td>
<td>
<ul>
<li>item</li>
<li>another item</li>
<li>another bulleted item</li>
</ul>
</td>
</tr>
<tr>
<td><tt> # item 1<br />
# item 2<br />
# item 3</tt></td>
<td>
<ol>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
</ol>
</td>
</tr>
<tr>
<td><tt>[[wiki name]]<br />
[[wiki name | different title]]</tt></td>
<td>Internal link to another page on the wiki</td>
</tr>
</tbody>
</table>
The code for the block visibility is as follows:
<?php
$view = FALSE;
$types = array('wiki' => 1);
if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == edit) { //edit pages
$nid = arg(1);
$node = node_load(array('nid' => $nid));
$type = $node->type;
if (isset($types[$type])) {
$view = TRUE;
}
}
else if (arg(0) == 'node' && arg(1) == 'add' && isset($types[arg(2)])) { //node add pages
$view = TRUE;
}
if (arg(0) == 'wiki' && arg(1) == 'newtopic') {
$view = TRUE;
}
return $view;
?>
Where 'wiki' is the name of the content type and the base URL for the wiki.$view = FALSE;
$types = array('wiki' => 1);
if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == edit) { //edit pages
$nid = arg(1);
$node = node_load(array('nid' => $nid));
$type = $node->type;
if (isset($types[$type])) {
$view = TRUE;
}
}
else if (arg(0) == 'node' && arg(1) == 'add' && isset($types[arg(2)])) { //node add pages
$view = TRUE;
}
if (arg(0) == 'wiki' && arg(1) == 'newtopic') {
$view = TRUE;
}
return $view;
?>


New Drupal Wiki Module
good news
Drupal Wiki Implementation
English version
SEO checklist is another
Re:
Alternatively, you can use flexifilter to make your own wiki filter - it includes an example filter that is similar to MediaWiki.
Update for FCKeditor
If you edit the FCKeditor Global Profile here -- admin/settings/fckeditor/editg
And add these to fields to exclude/include:
wiki@*.edit-body
*/node/add/wiki
You'll have the same result. It works pretty well from my investigation.
this was very helpful, and I
this was very helpful, and I used as a reference to build a wiki in D6:
http://cratel.wichita.edu/cratel/cratel_Drupal_6_wiki
My big question/concern is how to track down orphaned pages in the wiki. Any ideas?
filter by node type incompatible with drupal 6.4
The filter by node type module cannot be used on Drupal 6. The php trick for Tinymce however works great.
Re: filter by node type incompatible with drupal 6.4
The filter by node type
To the best of my knowledge
To the best of my knowledge you can install pathauto and configure the paths separately. Say you have two content types: blog and wiki. You can set your pathauto paths to /wiki/[title-raw] and /blog/[title-raw].
Then with TinyMCE you can say all /wiki/*/edit pages don't show the editor.
This has worked with other modules I have used that rely on URL paths, so it might work for this as well.
edit paths
Unfortunately, regardless of what the 'View' link is (say wiki/main_page) the 'Edit' link will always default to node/*/edit - not at all dependant on the URL alias of the node.
Wikitools does allow for custom URL extensions like /wiki/a-wiki-page/Edit, but unless you write a module to replace the Edit link with that, there's no simple way of filtering content types with a URL.
Fortunately, both TinyMCE and FCKEdit now have solutions for this, as presented above.
flexifilter
I used flexifilter to create a filter just for my wiki content type which changed paths from /path to //path. Drupal 6.8
drupal 6 patch
looks like there is a patch for drupal 6 available:
http://drupal.org/node/221424