About This Rule
// [snip] create a Text_Wiki object called $wiki
// get the list of pages in the wiki
$pages = array(
'HomePage',
'WordsSmashedTogether',
'SomeOtherPages'
);
$wiki->setRenderConf('xhtml', 'wikilink', 'pages', $pages);
Now Text_Wiki needs to know where to link pages to. There are two configuration keys for this, 'view_url' and 'new_url'. If the parser finds a page name that exists in the 'pages' array, it will use 'view_url'; if the page is not in the 'pages' array, it will use 'new_url'.
$wiki->setRenderConf('xhtml', 'wikilink', 'view_url',
'http://example.php/view.php?page=%s');
$wiki->setRenderConf('xhtml', 'wikilink', 'new_url',
'http://example.php/new.php?page=%s');
Note: Note the use of %s in the above URL strings; the %s will be replaced by the page name. If you specify a string that does not have a %s in it, Text_Wiki will assume that the page name should go at the very end of the string.
Finally, if the page exists, Text_Wiki will make the page name itself a link. If the page does not exist, Text_Wiki will add some text after the page name and make that clickable instead (leading to the 'new_url'). Normally the 'new_text' is just a question mark, but you can place any literal text you like.
// make the new_text a tilde
$wiki->setRenderConf('xhtml', 'wikilink', 'new_text', '~');
// make the new_text an image tag
$wiki->setRenderConf('xhtml', 'wikilink', 'new_text',
'
');