I have an array full of Strings. I am trying to remove the duplicates in the array, and display how much value there were. I don’t know if i’m clear.
Here is my code :
{loop type="product" name="mot-cle"}
{assign var="fooVar" value="{$POSTSCRIPTUM}"}
{assign var="parts" value=","|explode:$fooVar}
{foreach from=$parts key=k item=i}
<ul>
<li>{$i}</li>
</ul>
{/foreach}
{/loop}
This code display this :
test
test2.
test3
test3
test3.
test
test3
test.
test2
test3.
test2
test
test3.
test3
I wish to display this :
test (4)
test2 (3)
test3 (7)
PS : I am new with smarty.
Any help ?