```## tabid=module titletext='SimpleWiki Module' subjecttext='SimpleWiki PHP5 Module'
|:pre html:|{{{
}}}
= Module =
|:p div float:right:|%s smaller%//[[Local:display/article/module|view source markup]]//
See the %l newwin%[[Local:documentation|technical documentation]], or [[Local:download | download]].
|:p posting:|posted January 6, 2011; updated June 18, 2011
===[[#components]] Components ===
The SimpleWiki module consists of the following components:
====== source code ======
*muster/simplewiki.php
*muster/simplewiki/parser.php
*muster/simplewiki/emitter.php
*muster/simplewiki/docnode.php
====== css files ======
*SimpleWiki.css
====== javascript ======
* %l newwin%[[http://jquery.com/|jquery.js]] (see jquery website)
* SimpleWiki.js
====== images ======
*arrowdown.gif
*arrowup.gif
===[[#integration]] Integration ===
==== code ====
Use an autoloader like this:
{{{
function __autoload($class_name) {
include(strtr(strtolower($class_name),'\\','/') . '.php');
}
}}}
and call simplewiki like this:
{{{
$wiki = new Muster\SimpleWiki();
}}}
Normally invoke the same instance of SimpleWiki for repetitive parsing:
{{{
$html = $wiki->get_html($markup);
}}}
==== html ====
{{{
}}}
==== images ====
Place the images in the same directory as the css file.
===[[#extension]] Extension ===
Extend SimpleWiki by inserting your subclass into the calling chain.
Place your class extension in a separate php source file (eg. mysimpliwiki.php).
In your source file, extend the native version of the simplewiki code, like this
{{{
class MySimpleWiki extends Muster\SimpleWiki {
...
}
}}}
To extend other classes you'll have to change the %l newwin%[[http://php.net/manual/en/language.namespaces.php|namespace]] scheme.
===[[#registrations]] Registrations ===
Many lookups and callouts can be registered with SimpleWiki:
*register_class_callbacks
*register_property_callbacks
*register_symlinks
*register_symlink_handler
*register_rawlink_handler
*register_charfilter_handler
*register_blockdef_handler (block tags)
*register_vblockdef_handler (void block tags)
*register_itagdef_handler (inline tags)
*register_vtagdef_handler (void inline tags)
*register_macro_callbacks
*register_events
Callbacks, handlers, and events are all handed, and expected to return, the $node object which triggered the handler or callout, except the charfilter handler which is handed both the text and the node, and is expected to return the filtered text.
See the %l newwin%[[Local:documentation|technical documentation]] for the %l newwin%[[Local:documentation/class_muster___simple_wiki___doc_node.html|Muster\SimpleWiki\DocNode]] documentation which lists properties available for each type of node. All nodes have //type//, //parent//, and //children// properties.