[dokuwiki] Re: event order

> Apart from DOKUWIKI_STARTED and DOKUWIKI_DONE order isn't really
guaranteed, that's not the way events work.

Hi, are you saying
1. events in different page will have different sequences?
2. events in same page will possibly have different sequences each page
load?

I have inserted some echo in PARSER_WIKITEXT_PREPROCESS and
TPL_CONTENT_DISPLAY, looks like TPL runs before PARSER... see code below

class action_plugin_sidebarindex extends DokuWiki_Action_Plugin
{
        var $hasMenu = false;

        function _indexMenu(&$event, $param)
        {
                echo 'add';
                if ($_REQUEST['do']=='edit')return;
                if ($this->hasMenu)return;
                $event->data =
p_render('xhtml',p_get_instructions(file_get_contents(DOKU_PLUGIN.'sidebarindex/template.tpl')),
$info).$event->data;
        }

        function _check(&$event, $param)
        {
                echo 'check';
                if (strpos($event->data, '{{indexmenu'))
                {
                        $this->hasMenu = true;
                }
        }

        function getInfo()
        {
                return  array
                (
                        'name' => 'Sidebar Index Menu',
                        'email' => 'guanfenglin@xxxxxxxxx',
                        'date' => '04/12/2008',
                        'author' => 'James GuanFeng Lin',
                        'desc' => 'append home page to the page',
                        'url' => ''
                );
        }

        function register(&$controller)
        {

$controller->register_hook('TPL_CONTENT_DISPLAY','BEFORE',$this,
'_indexMenu', array());

$controller->register_hook('PARSER_WIKITEXT_PREPROCESS','BEFORE',$this,
'_check', array());
        }
}
?>

the page outputs 'add' before 'check'

Regards

James

Other related posts: