Skip to the content
Documentation

Re: Array inspection

No ratings yet

Yes, "foreach" is the common idea, but you can also use the function "get_type()" to show the length. Here is an example:
{def $somearray=...}
{def $length=$somearray|get_type()}
{for 0 to $length as $counter}
{$somearray[$counter]}
{/for}
{undef}
This is more helpful if you want to access the neighbour elements of the actual element, for example. If you do not need a counte, "foreach" is easier to use.