{assign var = foreach_name value = "menu`$level`"} {*assign var = itemsCount value = $menuItem.sub|@count*} {*math assign = 'half' equation = 'x / 2' x = $itemsCount*} {foreach from = $menu item = "menuItem" name = $foreach_name} {* li class *} {assign var = "class" value = ""} {if $menuItem.sub} {assign var = "class" value = "`$class` dropdown"} {if $menuItem.sub && $level > 1} {assign var = "class" value = "`$class`-submenu"} {/if} {/if} {if $menuItem.fullAlias == $CURRENT_PAGE || ($CURRENT_PAGE|strpos:"`$menuItem.fullAlias`/" === 0 && $menuItem.fullAlias != $parentFullAlias) || ($CURRENT_PAGE == '' && $menuItem.fullAlias == 'home')} {assign var = "class" value = "`$class` active"} {/if} {* link target *} {assign var = "target" value = ""} {if $menuItem.redirect == 'y'} {assign var = "target" value = $menuItem.redirectAlias|target} {elseif $menuItem.target} {assign var = "target" value = $menuItem.target} {/if} {* link url *} {if $menuItem.hasBlocks == 'n' && $menuItem.redirect == 'n'} {assign var = "url" value = "#"} {else} {if $menuItem.url} {assign var = "url" value = $menuItem.url} {else} {assign var = "url" value = "#"} {/if} {/if} {if $smarty.foreach.$foreach_name.first}