[dokuwiki] Re: Action Plugins
- From: Chris Smith <chris@xxxxxxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Sat, 22 Apr 2006 08:38:23 +0100
Martin Tschofen wrote:
I'm stuck with this. I've got two different action plugins. One that
overrides "index" and the other a new command all together called
"collect".
In my "index" command I don't mess with the $ACT variable and
everything works just as it should. So do I need to change $ACT at
all?
In the "collect" action plugin, dokuwiki complains that it doesn't
recognize the 'collect' command. I'm not clear about the right way to
register the command itself. I think I need to do it with the
ACTION_DISPATCH event:
$controller->register_hook('ACTION_DISPATCH', $this, 'collect', NULL);
$controller->register_hook('TPL_ACTION_HTML', $this, 'find_pages', NULL);
function collect($param, &$event){
if ($event->data != 'collect') return;
}
That doesn't work. Thanks in advance...martin
It doesn't work? or it doesn't do anything?
The code you have listed for collect does nothing. It returns if the
data isn't "collect", and then it returns anyway.
You need to add some code, at a minimum preventDefault(). If you don't
prevent default, when dokuwiki does its own error checking on the $ACT
value it'll find an illegal value and clear $ACT to NULL (or something
similar). Personally, I'd only register the "find_page" hook when you
discover you have the correct $ACT value.
function register(...) {
$controller->register_hook('ACTION_DISPATCH', $this, 'collect', NULL);
}
function collect(...) {
if ($event->data != "collect") return;
$event->preventDefault();
$controller->register_hook('TPL_ACTION_HTML', $this, 'find_pages', NULL);
}
Also, I am likely to submit a patch shortly implementing the results of
the discussions about action plugins, so things are likely to change -
please keep an eye out for the patch and the changes it'll list, in
particular the event name reorganisation.
Cheers,
Chris
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
- Follow-Ups:
- [dokuwiki] Re: Action Plugins
- From: Martin Tschofen
- References:
- [dokuwiki] Action Plugins
- From: Chris Smith
- [dokuwiki] Re: Action Plugins
- From: Andreas Gohr
- [dokuwiki] Re: Action Plugins
- From: Chris Smith
- [dokuwiki] Re: Action Plugins
- From: Martin Tschofen
- [dokuwiki] Re: Action Plugins
- From: Chris Smith
- [dokuwiki] Re: Action Plugins
- From: Martin Tschofen
Other related posts:
- » [dokuwiki] Action Plugins
- » [dokuwiki] Re: Action Plugins
- » [dokuwiki] Re: Action Plugins
- » [dokuwiki] Re: Action Plugins
- » [dokuwiki] Re: Action Plugins
- » [dokuwiki] Re: Action Plugins
- » [dokuwiki] Re: Action Plugins
- » [dokuwiki] Re: Action Plugins
- » [dokuwiki] Re: Action Plugins
- » [dokuwiki] Re: Action Plugins
- » [dokuwiki] Re: Action Plugins
- » [dokuwiki] Re: Action Plugins
- » [dokuwiki] Re: Action Plugins
- » [dokuwiki] Re: Action Plugins
- » [dokuwiki] Re: Action Plugins
- » [dokuwiki] Re: Action Plugins
- » [dokuwiki] Re: Action Plugins
- » [dokuwiki] Re: Action Plugins
- » [dokuwiki] Re: Action Plugins
- » [dokuwiki] Re: Action Plugins
- » [dokuwiki] Re: Action Plugins
I'm stuck with this. I've got two different action plugins. One that overrides "index" and the other a new command all together called "collect".
In my "index" command I don't mess with the $ACT variable and everything works just as it should. So do I need to change $ACT at all?
In the "collect" action plugin, dokuwiki complains that it doesn't
recognize the 'collect' command. I'm not clear about the right way to
register the command itself. I think I need to do it with the
ACTION_DISPATCH event:
$controller->register_hook('ACTION_DISPATCH', $this, 'collect', NULL);
$controller->register_hook('TPL_ACTION_HTML', $this, 'find_pages', NULL); function collect($param, &$event){
if ($event->data != 'collect') return;
}That doesn't work. Thanks in advance...martin
It doesn't work? or it doesn't do anything?
- [dokuwiki] Re: Action Plugins
- From: Martin Tschofen
- [dokuwiki] Action Plugins
- From: Chris Smith
- [dokuwiki] Re: Action Plugins
- From: Andreas Gohr
- [dokuwiki] Re: Action Plugins
- From: Chris Smith
- [dokuwiki] Re: Action Plugins
- From: Martin Tschofen
- [dokuwiki] Re: Action Plugins
- From: Chris Smith
- [dokuwiki] Re: Action Plugins
- From: Martin Tschofen