| 
									
										
										
										
											2020-11-25 10:32:42 +08:00
										 |  |  | {php} | 
					
						
							|  |  |  | function getMenus($menus, $level = 1, $currentFirstId, $categoryId) { | 
					
						
							|  |  |  |     $menuHtml = ''; | 
					
						
							| 
									
										
										
										
											2020-11-25 12:39:58 +08:00
										 |  |  |     $levelList = ['nav-first','nav-second','nav-third']; | 
					
						
							|  |  |  |     $navClass = $levelList[$level - 1] ?? ''; | 
					
						
							| 
									
										
										
										
											2020-11-25 10:32:42 +08:00
										 |  |  |     if (count($menus) > 0) { | 
					
						
							| 
									
										
										
										
											2020-11-25 12:39:58 +08:00
										 |  |  |         $menuHtml .= ''; | 
					
						
							|  |  |  |         if($level > 1) { | 
					
						
							|  |  |  |             $menuHtml .= '<div class="'.$navClass.'" >'; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2020-11-25 20:15:51 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-25 10:32:42 +08:00
										 |  |  |         foreach ($menus as $menu) { | 
					
						
							|  |  |  |             $activeClass = ''; | 
					
						
							| 
									
										
										
										
											2020-11-25 12:39:58 +08:00
										 |  |  |             if ($currentFirstId == $menu['id'] || $categoryId == $menu['id'] || ($currentFirstId == 0 && $menu['is_index'])) { | 
					
						
							|  |  |  |                 $activeClass = ' active'; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2020-11-25 20:15:51 +08:00
										 |  |  |             $aHref = getUri($menu); | 
					
						
							|  |  |  |             $aHref = empty($aHref) ? 'javascript:;' : $aHref; | 
					
						
							| 
									
										
										
										
											2020-12-09 09:21:58 +08:00
										 |  |  |             $spanClass = ''; | 
					
						
							|  |  |  |             $hasChild = false; | 
					
						
							|  |  |  |             if (isset($menu['children']) && count($menu['children']) > 0) { | 
					
						
							|  |  |  |                 $hasChild = true; | 
					
						
							|  |  |  |                 $spanClass = 'class="cur"'; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2020-11-25 12:39:58 +08:00
										 |  |  |             if($level == 1) { | 
					
						
							|  |  |  |                 $menuHtml .= '<li class="'.$activeClass.'" >'; | 
					
						
							| 
									
										
										
										
											2020-12-09 09:21:58 +08:00
										 |  |  |                 $menuHtml .= '<span '.$spanClass.'><a href="'.$aHref.'" target="'.$menu['style'].'">'.$menu['title'].'</a></span>'; | 
					
						
							|  |  |  |                 if ($hasChild) { | 
					
						
							| 
									
										
										
										
											2020-11-25 12:39:58 +08:00
										 |  |  |                     $menuHtml .= getMenus($menu['children'], $level + 1, $currentFirstId, $categoryId); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 $menuHtml .= '</li>'; | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 $menuHtml .= '<a href="'.$aHref.'" target="'.$menu['style'].'" class="'.$activeClass.'">'; | 
					
						
							| 
									
										
										
										
											2020-12-09 09:21:58 +08:00
										 |  |  |                 $menuHtml .= '<span '.$spanClass.'>'.$menu['title'].'</span>'; | 
					
						
							|  |  |  |                 if ($hasChild) { | 
					
						
							| 
									
										
										
										
											2020-11-25 12:39:58 +08:00
										 |  |  |                     $menuHtml .= getMenus($menu['children'], $level + 1, $currentFirstId, $categoryId); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 $menuHtml .= '</a>'; | 
					
						
							| 
									
										
										
										
											2020-11-25 10:32:42 +08:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2020-11-25 12:39:58 +08:00
										 |  |  |         if($level > 1) { | 
					
						
							|  |  |  |             $menuHtml .= '</div>'; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2020-11-25 10:32:42 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |     return $menuHtml; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | {/php} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-25 12:39:58 +08:00
										 |  |  | <div class="head-box w-100"> | 
					
						
							|  |  |  |     <div class="w-1500"> | 
					
						
							|  |  |  |         <div class="center-block w-100 between-center"> | 
					
						
							|  |  |  |             <div class="logo center-center"> | 
					
						
							|  |  |  |                 <a href="{:url('/')}"><img src="__IMG__/logo.png"></a> | 
					
						
							|  |  |  |             </div> | 
					
						
							|  |  |  |             <div class="nav"> | 
					
						
							|  |  |  |                 <ul> | 
					
						
							|  |  |  |                     {:getMenus($menus, 1, $currentFirstId, $categoryId)} | 
					
						
							|  |  |  |                 </ul> | 
					
						
							|  |  |  |             </div> | 
					
						
							| 
									
										
										
										
											2020-12-01 09:16:27 +08:00
										 |  |  |             <!-- <div class="language">
 | 
					
						
							| 
									
										
										
										
											2020-11-25 12:39:58 +08:00
										 |  |  |                 <a href="" class="active">中文</a> / <a href="">English</a> | 
					
						
							| 
									
										
										
										
											2020-12-01 09:16:27 +08:00
										 |  |  |             </div> --> | 
					
						
							| 
									
										
										
										
											2020-11-25 12:39:58 +08:00
										 |  |  |             <div class="nav_btn"> | 
					
						
							| 
									
										
										
										
											2020-11-25 09:07:06 +08:00
										 |  |  |                 <i class="bar-top"></i> | 
					
						
							|  |  |  |                 <i class="bar-cen"></i> | 
					
						
							|  |  |  |                 <i class="bar-bom"></i> | 
					
						
							|  |  |  |             </div> | 
					
						
							|  |  |  |         </div> | 
					
						
							|  |  |  |     </div> | 
					
						
							|  |  |  | </div> |