[eZ publish] How to add a element to an array.

Assumed that $old_array is an array.

{def $new_array = array()}
{
foreach $old_array as $key=>$model}
{set
$new_array = $new_array|append($model)}
{
/foreach}
Pay attention to the code: {set $new_array = $new_array|append($model)}, we have to use "set" to add the value to the array!

So wired!

原文地址:https://www.cnblogs.com/davidhhuan/p/1738454.html