diff options
| author | Chris Smith <toonarmy@phpbb.com> | 2008-11-25 00:31:32 +0000 |
|---|---|---|
| committer | Chris Smith <toonarmy@phpbb.com> | 2008-11-25 00:31:32 +0000 |
| commit | c95f0c793543e4af68df133a09d0db5af3b4a822 (patch) | |
| tree | 083ba1a68a3ea44b83617262be62c6add84c25f1 /phpBB/includes/functions_template.php | |
| parent | 332521a3696df8e1504933bee5658d005549f3b4 (diff) | |
| download | forums-c95f0c793543e4af68df133a09d0db5af3b4a822.tar forums-c95f0c793543e4af68df133a09d0db5af3b4a822.tar.gz forums-c95f0c793543e4af68df133a09d0db5af3b4a822.tar.bz2 forums-c95f0c793543e4af68df133a09d0db5af3b4a822.tar.xz forums-c95f0c793543e4af68df133a09d0db5af3b4a822.zip | |
- Add template variable S_BLOCK_NAME
- Modify template::alter_block_array() so it supports modification of nested blocks
- Add (incomplete) tests for template::alter_block_array()
git-svn-id: file:///svn/phpbb/trunk@9116 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_template.php')
| -rw-r--r-- | phpBB/includes/functions_template.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php index c8c79ab5e4..71de53b4c4 100644 --- a/phpBB/includes/functions_template.php +++ b/phpBB/includes/functions_template.php @@ -458,6 +458,10 @@ class template_filter extends php_user_filter $token = "(\$_${namespace}_i == \$_${namespace}_count - 1)"; break; + case 'S_BLOCK_NAME': + $token = "'$namespace'"; + break; + default: $token = $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']'; break; @@ -637,6 +641,8 @@ class template_filter extends php_user_filter // Strip the trailing period. $namespace = substr($namespace, 0, -1); + $expr = true; + // S_ROW_COUNT is deceptive, it returns the current row number now the number of rows // hence S_ROW_COUNT is deprecated in favour of S_ROW_NUM switch ($varname) @@ -658,6 +664,10 @@ class template_filter extends php_user_filter $varref = "(\$_${namespace}_i == \$_${namespace}_count - 1)"; break; + case 'S_BLOCK_NAME': + $varref = "'$namespace'"; + break; + default: // Get a reference to the data block for this namespace. $varref = $this->generate_block_data_ref($namespace, true, $defop); @@ -665,9 +675,12 @@ class template_filter extends php_user_filter // Append the variable reference. $varref .= "['$varname']"; + + $expr = false; break; } - $varref = ($echo) ? "<?php echo $varref; ?>" : ((isset($varref)) ? $varref : ''); + // @todo Test the !$expr more + $varref = ($echo) ? "<?php echo $varref; ?>" : (($expr || isset($varref)) ? $varref : ''); return $varref; } |
