{function menuTree}
   <ul class="{$ul_class}">
       {foreach $menu as $item}
          <li class="{if $item.selected}active {/if} item-{$item.id}">
             <a href="{$item.url nofilter}" {if $item.target != ''}target="{$item.target}" rel="noreferrer"{/if}>
                 {$item.title}
             </a>
              {if $item.children and $item.level < $level_max}
                  {menuTree menu=$item.children}
              {/if}
          </li>
       {/foreach}
   </ul>
{/function}

<div class="{$menu_class}">
    {menuTree menu=$menu}
</div>
