Fixed bug that wouldn't let you do specify non-array values for 'loop'

attribute.
This commit is contained in:
andrey
2001-01-22 15:15:49 +00:00
parent e9bc073666
commit 5460994906
4 changed files with 4 additions and 4 deletions

View File

@@ -568,7 +568,7 @@ class Smarty
foreach ($attrs as $attr_name => $attr_value) { foreach ($attrs as $attr_name => $attr_value) {
switch ($attr_name) { switch ($attr_name) {
case 'loop': case 'loop':
$output .= "{$section_props}['loop'] = count($attr_value);\n"; $output .= "{$section_props}['loop'] = is_array($attr_value) ? count($attr_value) : $attr_value;\n";
break; break;
case 'show': case 'show':

View File

@@ -15,7 +15,7 @@ the value of $SCRIPT_NAME is {$SCRIPT_NAME}
hello, my name is {$Name|upper} hello, my name is {$Name|upper}
My interests are: My interests are:
{section name=outer loop=$FirstName} {section name=outer loop=2}
{if %outer.index% is odd by 2} {if %outer.index% is odd by 2}
{%outer.rownum%} . {$outer/FirstName} {$outer/LastName} {%outer.rownum%} . {$outer/FirstName} {$outer/LastName}
{else} {else}

View File

@@ -568,7 +568,7 @@ class Smarty
foreach ($attrs as $attr_name => $attr_value) { foreach ($attrs as $attr_name => $attr_value) {
switch ($attr_name) { switch ($attr_name) {
case 'loop': case 'loop':
$output .= "{$section_props}['loop'] = count($attr_value);\n"; $output .= "{$section_props}['loop'] = is_array($attr_value) ? count($attr_value) : $attr_value;\n";
break; break;
case 'show': case 'show':

View File

@@ -15,7 +15,7 @@ the value of $SCRIPT_NAME is {$SCRIPT_NAME}
hello, my name is {$Name|upper} hello, my name is {$Name|upper}
My interests are: My interests are:
{section name=outer loop=$FirstName} {section name=outer loop=2}
{if %outer.index% is odd by 2} {if %outer.index% is odd by 2}
{%outer.rownum%} . {$outer/FirstName} {$outer/LastName} {%outer.rownum%} . {$outer/FirstName} {$outer/LastName}
{else} {else}