{php $child = get_maincat(0, $mid, 1);}

{loop $child $i $c} {if $i%2==0}
{/if} {set_style($c[catname], $c[style])} {if $c[child]} {php $sub = get_maincat($c[catid], $mid, 2);} {loop $sub $j $s}{if $j < 5}|{set_style($s[catname], $s[style])}{/if}{/loop} {/if} {if $c[child]} {php $sub = get_maincat($c[catid], $mid, 1);} {php $n = count($sub) - 1;} {loop $sub $j $s} {set_style($s[catname], $s[style])}{if $j < $n}|{/if} {/loop} {/if} {if $i%2==1}
{/if} {/loop}