Smarty: print a specific element of an array WITHOUT using foreach loop
{foreach from=$myArray item开发者_高级运维=item}
{$item.attribute}
{/foreach}
instead of printing all attributes of each element of the array, I want to output only the 3rd element WITHOUT using a foreach loop, is it possible?
I'm looking for something like the below, but I don't know the syntax:
$myArray[2].attribute
{$myArray[2].attribute}
would be correct. Did you try it?
Use {$myArray.2.attribute}
to get the attribute.
$myArray[2]->attribute this one works for me.
精彩评论