From 7ea0913c940324ef33e9b89d2468bde5d84da2e4 Mon Sep 17 00:00:00 2001
From: chris <chris@jalakai.co.uk>
Date: Sat, 15 Apr 2006 18:08:47 +0200
Subject: [PATCH] events TPL_ACTION_HTML & TPL_DISPLAY_HTML

event   TPL_ACTION_HTML
data    $ACT
action  tpl_content_core (formerly tpl_content)

This event is a wrapper for tpl_content() (now tpl_content_core()) and as such is a
full trigger, meaning it issues three advises:
- TPL_ACTION_HTML_before
- TPL_ACTION_HTML
- TPL_ACTION_HTML_after

Event handlers can output HTML before and/or after the main Dokuwiki page output and
can prevent the default dokuwiki page generation taking place.

Example uses could include:
- replacements for dokuwiki command handlers like index.
- appending a discussion section to the page by handling TPL_ACTION_HTML_after

event   TPL_DISPLAY_HTML
data    html output produced by tpl_content_core[1]
action  send output to browser

Event handlers can post process the HTML output before it is sent to the client
browser. This is a full trigger, meaning it issues three advises
- TPL_DISPLAY_HTML_before
- TPL_DISPLAY_HTML
- TPL_DISPLAY_HTML_after

darcs-hash:20060415160847-9b6ab-d7affcb1aaf49aecfaf9bc1e78a82ceb8ae409f7.gz
---
 inc/template.php | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/inc/template.php b/inc/template.php
index 4383c7a6b..5e98526ff 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -36,7 +36,22 @@ function template($tpl){
  *
  * @author Andreas Gohr <andi@splitbrain.org>
  */
-function tpl_content(){
+function tpl_content() {
+  global $ACT;
+
+  ob_start();
+
+  $evt = new event('TPL_ACTION_HTML',$ACT,tpl_content_core);
+  $evt->trigger();
+
+  $html_output = ob_get_clean();
+
+  $evt = new event('TPL_DISPLAY_HTML',$html_output,ptln);
+  $evt->trigger();
+
+}
+
+function tpl_content_core(){
   global $ACT;
   global $TEXT;
   global $PRE;
-- 
GitLab