aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/includes/functions_template.php8
-rw-r--r--tests/template/template.php6
-rw-r--r--tests/template/templates/loop_vars.html2
3 files changed, 13 insertions, 3 deletions
diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php
index da11ff6e89..920b235cb3 100644
--- a/phpBB/includes/functions_template.php
+++ b/phpBB/includes/functions_template.php
@@ -427,6 +427,10 @@ class template_filter extends php_user_filter
$token = "\$_${namespace}_i";
break;
+ case 'S_NUM_ROWS':
+ $token = "\$_${namespace}_count";
+ break;
+
case 'S_FIRST_ROW':
$token = "(\$_${namespace}_i == 0)";
break;
@@ -618,6 +622,10 @@ class template_filter extends php_user_filter
$varref = "\$_${namespace}_i";
break;
+ case 'S_NUM_ROWS':
+ $varref = "\$_${namespace}_count";
+ break;
+
case 'S_FIRST_ROW':
$varref = "(\$_${namespace}_i == 0)";
break;
diff --git a/tests/template/template.php b/tests/template/template.php
index f1ab22dc2b..0cbfadb61a 100644
--- a/tests/template/template.php
+++ b/tests/template/template.php
@@ -111,19 +111,19 @@ class phpbb_template_template_test extends PHPUnit_Framework_TestCase
'loop_vars.html',
array(),
array('loop' => array(array('VARIABLE' => 'x'))),
- "first\n0\n0\nx\nlast",
+ "first\n0\n0\n1\nx\nlast",
),
array(
'loop_vars.html',
array(),
array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y'))),
- "first\n0\n0\nx\n1\n1\ny\nlast",
+ "first\n0\n0\n2\nx\n1\n1\n2\ny\nlast",
),
array(
'loop_vars.html',
array(),
array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())),
- "first\n0\n0\nx\n1\n1\ny\nlast\n0\n1",
+ "first\n0\n0\n2\nx\n1\n1\n2\ny\nlast\n0\n1",
),
array(
'define.html',
diff --git a/tests/template/templates/loop_vars.html b/tests/template/templates/loop_vars.html
index d708e5a40c..6bbd4a2710 100644
--- a/tests/template/templates/loop_vars.html
+++ b/tests/template/templates/loop_vars.html
@@ -5,6 +5,8 @@
{loop.S_ROW_NUM}
+{loop.S_NUM_ROWS}
+
{loop.VARIABLE}
<!-- IF loop.S_LAST_ROW -->last<!-- ENDIF -->