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