2020-11-25 02:32:42 +00:00
|
|
|
{php}
|
|
|
|
function getMenus($menus, $level = 1, $currentFirstId, $categoryId) {
|
|
|
|
$menuHtml = '';
|
|
|
|
if (count($menus) > 0) {
|
|
|
|
$menuHtml .= '<ul class="menu-level-'.$level.'">';
|
|
|
|
foreach ($menus as $menu) {
|
|
|
|
$activeClass = '';
|
|
|
|
if ($currentFirstId == $menu['id']) {
|
|
|
|
$activeClass = ' menu-active';
|
|
|
|
} elseif ($categoryId == $menu['id']) {
|
|
|
|
$activeClass = ' menu-item-active';
|
|
|
|
}
|
|
|
|
$menuHtml .= '<li class="menu-item-level-'.$level.$activeClass.'" >';
|
|
|
|
$aHref = 'javascript:;';
|
|
|
|
if (!empty($menu['url'])) {
|
|
|
|
$aHref = $menu['url'];
|
|
|
|
} elseif ($menu['is_index']) {
|
|
|
|
$aHref = url('/');
|
|
|
|
} elseif (!empty($menu['template'])) {
|
|
|
|
$aHref = url('/'.$menu['template'].'/'.$menu['id']);
|
|
|
|
}
|
|
|
|
$menuHtml .= '<span><a href="'.$aHref.'" target="'.$menu['style'].'">'.$menu['title'].'</a></span>';
|
|
|
|
if (isset($menu['children']) && count($menu['children']) > 0) {
|
|
|
|
$menuHtml .= getMenus($menu['children'], $level + 1, $currentFirstId, $categoryId);
|
|
|
|
}
|
|
|
|
$menuHtml .= '</li>';
|
|
|
|
}
|
|
|
|
$menuHtml .= '</ul>';
|
|
|
|
}
|
|
|
|
return $menuHtml;
|
|
|
|
}
|
|
|
|
{/php}
|
|
|
|
|
2020-11-25 01:07:06 +00:00
|
|
|
<div class="head_box wf100">
|
|
|
|
<div class="between-center w90">
|
|
|
|
<a href=""><img src="__IMG__/logo.png" class="logo" alt=""></a>
|
|
|
|
<div class="fr between-center">
|
|
|
|
<div class="head_menu">
|
2020-11-25 02:32:42 +00:00
|
|
|
{:getMenus($menus, 1, $currentFirstId, $categoryId)}
|
2020-11-25 01:07:06 +00:00
|
|
|
</div>
|
|
|
|
<div class="head_btn">
|
|
|
|
<i class="bar-top"></i>
|
|
|
|
<i class="bar-cen"></i>
|
|
|
|
<i class="bar-bom"></i>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|