From 9545a9f9b07f7d798e974a34e591fcc3f0144406 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 21 Dec 2005 19:40:21 +0000 Subject: [PATCH] Created a pre-parse hook for template processing --- template.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/template.php b/template.php index 009bb7a..1acffeb 100644 --- a/template.php +++ b/template.php @@ -106,6 +106,12 @@ class Template */ var $doneflush = false; + /** + * The name of a function that is called before template parsing of phrases and conditionals occurs + * @var string + */ + var $pre_parse_hook = ':=NO METHOD=:'; + // ################################################################### /** * Constructor @@ -264,6 +270,13 @@ class Template function _parse($template) { $template = str_replace('"', '\"', $template); + + if (function_exists($this->pre_parse_hook)) + { + $this->registry->debug("running pre-parse hook: {$this->pre_parse_hook}"); + $template = call_user_func($this->pre_parse_hook, $template); + } + $template = $this->_parse_phrases($template); $template = $this->_parse_conditionals($template); return $template; -- 2.22.5