更新:菜单栏-多级菜单的父菜单添加curcss类名
parent
9db0a96685
commit
63f1189779
|
@ -17,17 +17,23 @@ function getMenus($menus, $level = 1, $currentFirstId, $categoryId) {
|
|||
}
|
||||
$aHref = getUri($menu);
|
||||
$aHref = empty($aHref) ? 'javascript:;' : $aHref;
|
||||
$spanClass = '';
|
||||
$hasChild = false;
|
||||
if (isset($menu['children']) && count($menu['children']) > 0) {
|
||||
$hasChild = true;
|
||||
$spanClass = 'class="cur"';
|
||||
}
|
||||
if($level == 1) {
|
||||
$menuHtml .= '<li class="'.$activeClass.'" >';
|
||||
$menuHtml .= '<span><a href="'.$aHref.'" target="'.$menu['style'].'">'.$menu['title'].'</a></span>';
|
||||
if (isset($menu['children']) && count($menu['children']) > 0) {
|
||||
$menuHtml .= '<span '.$spanClass.'><a href="'.$aHref.'" target="'.$menu['style'].'">'.$menu['title'].'</a></span>';
|
||||
if ($hasChild) {
|
||||
$menuHtml .= getMenus($menu['children'], $level + 1, $currentFirstId, $categoryId);
|
||||
}
|
||||
$menuHtml .= '</li>';
|
||||
} else {
|
||||
$menuHtml .= '<a href="'.$aHref.'" target="'.$menu['style'].'" class="'.$activeClass.'">';
|
||||
$menuHtml .= '<span>'.$menu['title'].'</span>';
|
||||
if (isset($menu['children']) && count($menu['children']) > 0) {
|
||||
$menuHtml .= '<span '.$spanClass.'>'.$menu['title'].'</span>';
|
||||
if ($hasChild) {
|
||||
$menuHtml .= getMenus($menu['children'], $level + 1, $currentFirstId, $categoryId);
|
||||
}
|
||||
$menuHtml .= '</a>';
|
||||
|
|
Loading…
Reference in New Issue