[dokuwiki] Re: solved: action plugin to use syntax plugins
- From: James Lin <guanfenglin@xxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Tue, 28 Apr 2009 07:34:11 +1200
Oh sure, it's an action event by registering to the event
"PARSER_WIKITEXT_PREPROCESS'"
sample code:
function register(&$controller)
{
$controller->register_hook('PARSER_WIKITEXT_PREPROCESS', 'BEFORE',
$this, 'drawIndexMenu',array());
}
function drawIndexMenu(&$event, $param)
{
global $conf;
global $INFO;
global $ACT;
//if edit mode then return immediately
if ($_REQUEST['do']=='edit')return;
//if this page is being included by another page, reture
immediately
if (!plugin_isdisabled('include') && ($include =&
plugin_load('helper', 'include'))) {
if (count($include->pages)>0)
return;
}
//if the raw text has not already contain the indexmenu, then
add the indexmenu
if (!strpos( $event->data, '{{indexmenu'))
{
$event->data =
file_get_contents(DOKU_PLUGIN.'sidebarindex/template.tpl').$event->data;
}
}
hope it makes sense, if anyone have a better approach, please let me know.
Regards
James
> Great, but could you tell us about this solution ?
> Thanks,
> Cyrille.
> <http://wiki.splitbrain.org/wiki:mailinglist>
>
Other related posts: