aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/template.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2003-04-10 21:35:31 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2003-04-10 21:35:31 +0000
commit3616d540947c67ea020c66d36518c792429bc163 (patch)
tree93dd295a1f5f88984a3b4b6a80c7097d0059628f /phpBB/includes/template.php
parentf2d09291474030c949a19e823d83fb62c09a0b54 (diff)
downloadforums-3616d540947c67ea020c66d36518c792429bc163.tar
forums-3616d540947c67ea020c66d36518c792429bc163.tar.gz
forums-3616d540947c67ea020c66d36518c792429bc163.tar.bz2
forums-3616d540947c67ea020c66d36518c792429bc163.tar.xz
forums-3616d540947c67ea020c66d36518c792429bc163.zip
initial 'view attachments' implementation. added new template var (merged include, to preserve previous block vars), could be changed later to consider caching. some config variables and upload icons are not present as of yet...
git-svn-id: file:///svn/phpbb/trunk@3807 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/template.php')
-rw-r--r--phpBB/includes/template.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php
index ceee724c81..079a40c0fe 100644
--- a/phpBB/includes/template.php
+++ b/phpBB/includes/template.php
@@ -247,6 +247,23 @@ class Template {
}
}
+ function merge_from_include($filename)
+ {
+ $handle = 'include_' . $this->include_counter++;
+
+ $this->filename[$handle] = $filename;
+ $this->files[$handle] = $this->make_filename($filename);
+
+ if (!file_exists($this->files[$handle]))
+ {
+ trigger_error("Template->pparse(): Couldn't load template file for handle $handle", E_USER_ERROR);
+ }
+
+ $content = implode('', @file($this->files[$handle]));
+
+ return ($content);
+ }
+
/**
* Root-level variable assignment. Adds to current assignments, overriding
* any existing variable assignment with the same name.
@@ -323,6 +340,14 @@ class Template {
*/
function compile($code, $do_not_echo = false, $retvar = '')
{
+ // Pull out all merging includes, to let them parse with the code
+ preg_match_all('#<!-- MERGE_INCLUDE(.*?)-->#s', $code, $matches);
+ $merge_blocks = $matches[1];
+ foreach($merge_blocks as $filename)
+ {
+ $code = preg_replace('#<!-- MERGE_INCLUDE ' . preg_quote(trim($filename)) . ' -->#s', $this->merge_from_include(trim($filename)), $code);
+ }
+
// Pull out all block/statement level elements and seperate
// plain text
preg_match_all('#<!-- PHP -->(.*?)<!-- ENDPHP -->#s', $code, $matches);