<{if count($categories) gt 0}>
<{foreach item=category from=$categories name=ii key=counter}>
<{if $category.image != ""}> <{/if}> <{$category.title}> (<{$category.totallink}>)
<{* $category.subcategories *}> <{foreach item=sub from=$category.subcategories key=count name=i}> <{if $sub.cid > 0}> <{$sub.title}> <{if !$smarty.foreach.i.last && $count<5}>,<{/if}> <{else}> <{$sub.title}> <{/if}> <{/foreach}>
<{if ($counter+1) is div by 3 || $smarty.foreach.ii.last}>
<{/if}> <{/foreach}>
<{else}> <{if ! ($category_id || $submitter_id)}> <{$smarty.const._MD_NO_CATEGORY}> <{/if}> <{/if}>