aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/template.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2003-04-10 23:58:30 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2003-04-10 23:58:30 +0000
commit9c8c50cdb735f5555ee8a647b9a87603d9ffc0d2 (patch)
tree2bd3dc88259ce666229aa05037ab5f4af63bd044 /phpBB/includes/template.php
parenta702dc6683350a77613087a32294201ba0e81c24 (diff)
downloadforums-9c8c50cdb735f5555ee8a647b9a87603d9ffc0d2.tar
forums-9c8c50cdb735f5555ee8a647b9a87603d9ffc0d2.tar.gz
forums-9c8c50cdb735f5555ee8a647b9a87603d9ffc0d2.tar.bz2
forums-9c8c50cdb735f5555ee8a647b9a87603d9ffc0d2.tar.xz
forums-9c8c50cdb735f5555ee8a647b9a87603d9ffc0d2.zip
Try this version of include ...
git-svn-id: file:///svn/phpbb/trunk@3810 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/template.php')
-rw-r--r--phpBB/includes/template.php40
1 files changed, 11 insertions, 29 deletions
diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php
index 079a40c0fe..c016c2740e 100644
--- a/phpBB/includes/template.php
+++ b/phpBB/includes/template.php
@@ -243,27 +243,10 @@ class Template {
$this->compiled_code[$handle] = $this->compile($this->uncompiled_code[$handle]);
$this->compile_write($handle, $this->compiled_code[$handle]);
- eval($this->compiled_code[$handle]);
+ return $handle;
}
}
- 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.
@@ -340,20 +323,16 @@ 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);
$php_blocks = $matches[1];
$code = preg_replace('#<!-- PHP -->(.*?)<!-- ENDPHP -->#s', '<!-- PHP -->', $code);
+ preg_match_all('#<!-- INCLUDE (.*?) -->#s', $code, $matches);
+ $include_blocks = $matches[1];
+ $code = preg_replace('#<!-- INCLUDE (.*?) -->#s', '<!-- INCLUDE -->', $code);
+
preg_match_all('#<!-- (.*?) (.*?)?[ ]?-->#s', $code, $blocks);
$text_blocks = preg_split('#<!-- (.*?) (.*?)?[ ]?-->#s', $code);
for($i = 0; $i < count($text_blocks); $i++)
@@ -391,16 +370,19 @@ class Template {
$compile_blocks[] = "// ENDIF\n}\n";
break;
case 'INCLUDE':
- $compile_blocks[] = '// INCLUDE ' . $blocks[2][$curr_tb] . "\n" . $this->compile_tag_include($blocks[2][$curr_tb]);
+ $temp = '';
+ list(, $temp) = each($include_blocks);
+ $compile_blocks[] = "// INCLUDE $temp\ninclude('" . $this->cachedir . $temp . ".' . \$phpEx);\n";
+ $this->assign_from_include($temp);
break;
- case 'INCLUDEPHP':
+/* case 'INCLUDEPHP':
$compile_blocks[] = '// INCLUDEPHP ' . $blocks[2][$curr_tb] . "\n" . $this->compile_tag_include_php($blocks[2][$curr_tb]);
break;
case 'PHP':
$temp = '';
list(, $temp) = each($php_blocks);
$compile_blocks[] = "// PHP START\n" . $temp . "\n// PHP END\n";
- break;
+ break;*/
default:
$this->compile_var_tags($blocks[0][$curr_tb]);
$trim_check = trim($blocks[0][$curr_tb]);