{foreach from=$array_categories item=v name=cat} {if !$v.parent_id} {if $v.icon}{$v.name}{/if} {$v.name|escape:"html"} {if $v.ads && $appearance.categ_count_ads}({$v.ads}){/if} {if $smarty.foreach.cat.index!=$categories|@count-1}{/if} {if $smarty.foreach.cat.index==$categories|@count-1 && $v.parent_id} {/if} {if $v.last && $smarty.foreach.cat.index!=$categories|@count-1} {/if} {/foreach}