Martin Tschofen wrote:
TPL_ACTION_HTML the event data is $ACT, the default action is to output XHTML per $ACT. Output buffering is in effect, so all output is captured before being passed to TPL_DISPLAY_HTML. If you prevent the default action you should output any XHTML yourself.I'm wondering about the exact order of how the events will output the results and how to access the processed content. For testing purposes I came up with this custom action:
function register(&$controller) { $controller->register_hook('ACTION_DISPATCH', $this, 'collect', NULL); }
function collect($param, &$event){ if ($event->data != 'collect') return; $event->preventDefault(); global $EVENT_HANDLER; $EVENT_HANDLER->register_hook('TPL_ACTION_HTML', $this, 'tpl_action', NULL); $EVENT_HANDLER->register_hook('TPL_DISPLAY_HTML',$this,'tpl_display',NULL); $EVENT_HANDLER->register_hook('TPL_DISPLAY_HTML_AFTER',$this,'tpl_display_after',NULL); $event->stopPropagation(); } function tpl_action($param, &$event){ print "Collect print<br>"; $event->preventDefault(); $event->stopPropagation(); }
function tpl_display($param, &$event){ print $event->data; print "TPL_Display_HTML output<br>"; }
function tpl_display_after($param, &$event){ print $event->result; print "TPL_Display_HTML_AFTER output<br>"; }
What I noticed: In a custom action I really don't need TPL_DISPLAY_ACTION and TPL_DISPLAY_ACTION_AFTER as I can just use TPL_ACTION_HTML to output all what I need to do. For testing however, when I run this, I end up with the output of the
tpl_display function and then tpl_action: "Collect print TPL_Display_HTML output Collect print"
It looks like TPL_DISPLAY_HTML outputs before TPL_ACTION_HTML and TPL_ACTION_HTML_AFTER not at all.
I suspect I shouldn't "print" content. I tried returning it from the function and putting it into $event->result. Neither made a difference.
Please enlighten me...martin
First comes:
Cheers,
Chris
-- DokuWiki mailing list - more info at http://wiki.splitbrain.org/wiki:mailinglist