aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/template.php
diff options
context:
space:
mode:
authorDavid M <davidmj@users.sourceforge.net>2006-12-23 18:27:15 +0000
committerDavid M <davidmj@users.sourceforge.net>2006-12-23 18:27:15 +0000
commit0d502f3b07df4c198688d87a08bd6f785db77a1d (patch)
tree7c7dfff63bf3b0841f0bf3def168f903a328ae00 /phpBB/includes/template.php
parent3182317ef19a1a5fd632c1e645534fb1b056a578 (diff)
downloadforums-0d502f3b07df4c198688d87a08bd6f785db77a1d.tar
forums-0d502f3b07df4c198688d87a08bd6f785db77a1d.tar.gz
forums-0d502f3b07df4c198688d87a08bd6f785db77a1d.tar.bz2
forums-0d502f3b07df4c198688d87a08bd6f785db77a1d.tar.xz
forums-0d502f3b07df4c198688d87a08bd6f785db77a1d.zip
- quite a few optimizations to the template engine. bitwise arithmatic is used to check odd/even, usage of ref to the root template variables should reduce the number of hash lookups needed, usage of refs within loops should reduce the amount of hash lookups, incrementing vars were turned from class variables to regular variables, cache now uses preincrementing variables instead of postincrementing variables, some regex were optimized/trimmed
- a bug fix somewhere in there... git-svn-id: file:///svn/phpbb/trunk@6796 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/template.php')
-rw-r--r--phpBB/includes/template.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php
index 76a89869f5..97c92558b6 100644
--- a/phpBB/includes/template.php
+++ b/phpBB/includes/template.php
@@ -23,11 +23,12 @@ class template
{
/** variable that holds all the data we'll be substituting into
* the compiled templates. Takes form:
- * --> $this->_tpldata[block.][iteration#][child.][iteration#][child2.][iteration#][variablename] == value
+ * --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value
* if it's a root-level variable, it'll be like this:
* --> $this->_tpldata[.][0][varname] == value
*/
- var $_tpldata = array();
+ var $_tpldata = array('.' => array(0 => array()));
+ var $_rootref;
// Root dir and hash of filenames for each template handle.
var $root = '';
@@ -55,6 +56,8 @@ class template
trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR);
}
+ $this->_rootref = &$this->_tpldata['.'][0];
+
return true;
}
@@ -104,7 +107,7 @@ class template
*/
function destroy()
{
- $this->_tpldata = array();
+ $this->_tpldata = array('.' => array(0 => array()));
}
/**
@@ -205,7 +208,7 @@ class template
$compile = new template_compile($this);
// If the file for this handle is already loaded and compiled, do nothing.
- if (!empty($this->uncompiled_code[$handle]))
+ if (!empty($this->compiled_code[$handle]))
{
return true;
}
@@ -281,7 +284,7 @@ class template
{
foreach ($vararray as $key => $val)
{
- $this->_tpldata['.'][0][$key] = $val;
+ $this->_rootref[$key] = $val;
}
return true;
@@ -293,7 +296,7 @@ class template
*/
function assign_var($varname, $varval)
{
- $this->_tpldata['.'][0][$varname] = $varval;
+ $this->_rootref[$varname] = $varval;
return true;
}