Skip to the content
Documentation

Array inspection / Variable usage / The template language...

No ratings yet

Historical. Comments that readers left on the eZ Publish documentation of this topic, kept for reference. They describe earlier versions and are not maintained; the current page for Exponential 6 is Variable usage.

Contributors

Comments (2 historical)

Written by readers of the earlier documentation sites, kept as they were.

  1. Re: Array inspection

    Lars ·

    You can use the FOREACH construct.

  2. Re: Array inspection

    Markus ·

    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.

Comments

Add a comment

Comments are read by a moderator before they appear.