mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 19:04:27 +02:00
Fixed bug that wouldn't let you do specify non-array values for 'loop'
attribute.
This commit is contained in:
@@ -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':
|
||||||
|
@@ -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}
|
||||||
|
@@ -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':
|
||||||
|
@@ -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}
|
||||||
|
Reference in New Issue
Block a user