<{foreach item=cat from=$tree name=tree}>
<{if $smarty.foreach.tree.first}>
<{assign var=d value=$cat->getDepth()}>
<{/if}>
<{if $smarty.foreach.tree.first || $d < $cat->getDepth()}>
<{/section}>
<{$cat->getShow('title')}>
<{/if}>
<{if $smarty.foreach.tree.last}>
<{section name=i start=0 loop=$cat->getDepth()}>
<{/section}>
<{/if}>
<{assign var=d value=$cat->getDepth()}>
<{/foreach}>