Skip to the content
Documentation

What about objects, nodes ?

No ratings yet

It doesn't work with nodes.

Before :
<ul>
{foreach $all_related_albums as $related_album}
        <li>{$related_album.main_node.node_id}</li>
{/foreach}
</ul>

{def $unique_related_albums=$all_related_albums|unique()}

After :
<ul>
{foreach $unique_related_albums as $related_album}
        <li>{$related_album.main_node.node_id}</li>
{/foreach}
</ul>

produces the following output :

Before :
7360
7360
7360
7360
7360
4166

After :
7360

You have to build an intermediate array with node id's, then use unique, then re-fetch all nodes...