aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/template.php
diff options
context:
space:
mode:
authorChris Smith <toonarmy@phpbb.com>2008-11-22 23:53:40 +0000
committerChris Smith <toonarmy@phpbb.com>2008-11-22 23:53:40 +0000
commit416270ee77c32d9ff876dedc4b6c4a2eb7296a96 (patch)
tree3a433621dab6ce4832d7b7d6e8868725e7fb99d5 /phpBB/includes/template.php
parentefe06af91327e0eb30b98b6c848d72c66774c0e9 (diff)
downloadforums-416270ee77c32d9ff876dedc4b6c4a2eb7296a96.tar
forums-416270ee77c32d9ff876dedc4b6c4a2eb7296a96.tar.gz
forums-416270ee77c32d9ff876dedc4b6c4a2eb7296a96.tar.bz2
forums-416270ee77c32d9ff876dedc4b6c4a2eb7296a96.tar.xz
forums-416270ee77c32d9ff876dedc4b6c4a2eb7296a96.zip
- Deprecate S_ROW_COUNT use S_ROW_NUM
- S_ROW_NUM, S_FIRST_ROW, S_LAST_ROW are now using internal template engine variables saving memory - Other small changes - Update of template tests git-svn-id: file:///svn/phpbb/trunk@9087 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/template.php')
-rw-r--r--phpBB/includes/template.php49
1 files changed, 1 insertions, 48 deletions
diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php
index 814d6d2e50..25f2fa1cad 100644
--- a/phpBB/includes/template.php
+++ b/phpBB/includes/template.php
@@ -211,7 +211,7 @@ class template
$filename = $this->cachepath . str_replace('/', '.', $this->filename[$handle]) . '.' . PHP_EXT;
- $recompile = (($config['load_tplcompile'] && @filemtime($filename) < filemtime($this->files[$handle])) || !file_exists($filename) || @filesize($filename) === 0) ? true : false;
+ $recompile = (!file_exists($filename) || @filesize($filename) === 0 || ($config['load_tplcompile'] && @filemtime($filename) < filemtime($this->files[$handle]))) ? true : false;
// Recompile page if the original template is newer, otherwise load the compiled version
if ($recompile)
@@ -311,23 +311,6 @@ class template
$str = &$str[sizeof($str) - 1];
}
- $s_row_count = isset($str[$blocks[$blockcount]]) ? sizeof($str[$blocks[$blockcount]]) : 0;
- $vararray['S_ROW_COUNT'] = $s_row_count;
-
- // Assign S_FIRST_ROW
- if (!$s_row_count)
- {
- $vararray['S_FIRST_ROW'] = true;
- }
-
- // Now the tricky part, we always assign S_LAST_ROW and remove the entry before
- // This is much more clever than going through the complete template data on display (phew)
- $vararray['S_LAST_ROW'] = true;
- if ($s_row_count > 0)
- {
- unset($str[$blocks[$blockcount]][($s_row_count - 1)]['S_LAST_ROW']);
- }
-
// Now we add the block that we're actually assigning to.
// We're adding a new iteration to this block with the given
// variable assignments.
@@ -336,21 +319,6 @@ class template
else
{
// Top-level block.
- $s_row_count = (isset($this->_tpldata[$blockname])) ? sizeof($this->_tpldata[$blockname]) : 0;
- $vararray['S_ROW_COUNT'] = $s_row_count;
-
- // Assign S_FIRST_ROW
- if (!$s_row_count)
- {
- $vararray['S_FIRST_ROW'] = true;
- }
-
- // We always assign S_LAST_ROW and remove the entry before
- $vararray['S_LAST_ROW'] = true;
- if ($s_row_count > 0)
- {
- unset($this->_tpldata[$blockname][($s_row_count - 1)]['S_LAST_ROW']);
- }
// Add a new iteration to this block with the variable assignments we were given.
$this->_tpldata[$blockname][] = $vararray;
@@ -427,28 +395,13 @@ class template
// Insert Block
if ($mode == 'insert')
{
- // Make sure we are not exceeding the last iteration
- if ($key >= sizeof($this->_tpldata[$blockname]))
- {
- $key = sizeof($this->_tpldata[$blockname]);
- unset($this->_tpldata[$blockname][($key - 1)]['S_LAST_ROW']);
- $vararray['S_LAST_ROW'] = true;
- }
- else if ($key === 0)
- {
- unset($this->_tpldata[$blockname][0]['S_FIRST_ROW']);
- $vararray['S_FIRST_ROW'] = true;
- }
-
// Re-position template blocks
for ($i = sizeof($this->_tpldata[$blockname]); $i > $key; $i--)
{
$this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i-1];
- $this->_tpldata[$blockname][$i]['S_ROW_COUNT'] = $i;
}
// Insert vararray at given position
- $vararray['S_ROW_COUNT'] = $key;
$this->_tpldata[$blockname][$key] = $vararray;
return true;