<?php
//主菜单生成  {ls_mainmenu},   $menu_mainpc 电脑菜单 , menu_mainmb 手机菜单, _inc_allrepltags.php 处理路径 
// <div class="container">{ls_mainmenu}</div>  </div></div></div></div></div><div class="demo-2">

$menulistar=$menu_prorows['hotLines'];//菜单是否列出文章标题
$menufunc=$menu_prorows['functionName'];
$funcfolder=$menu_prorows['folder'];
$showfunc=$menufunc;

if($menufunc=="博客分类" or $menufunc=="常见问题" or $menufunc=="新闻分类") $showfunc=getlangmemu($menu_prorows['cateName']);
$menufunc_url=$menu_prorows['typeurl'];
$ifin=(strpos(strtolower($menufunc_url),"http")===false);
$inout=$ifin?"../":"";  //带域名的路径不用 ../

//echo $menu_prorows['cateName']."==<br/>";
$menu_mainpchm='<div class="navbar-lg">
<div class="nav-padding">
      <div class="collapse navbar-collapse" id="navbar-collapse">
        <ul class="nav navbar-nav nav-ul">
	  <li class="active"><a href="../index.html" >  <translate>'.getlangmemu("home").'</translate>	</a></li>';

if($mi==1){$menu_mainpc=$menu_mainpchm;		 } //home

if(  $menu_prorows['cateName'] !="products"  ){ //非产品菜单

	$menucate_sql="SELECT * FROM ls_functioncates   where functionName='".$menufunc."' and cateName!='' ".$addcatestr2."  and enable=1 order by Num";

	$menucate_query=$opendb->query($menucate_sql);

	$menucate_num=mysqli_num_rows($menucate_query); //总数

	//$menu_suffurl=$menu_prorows['suffStr'].'.html';

	if($menucate_num==0){ //大类无中类

		$cateurl1=funccatear1($menufunc);	//大类下1篇文章

		$menufunc_url=$cateurl1!=">1"?$cateurl1:$menufunc_url; //1篇文章跳过列表页
		$menu_mainpc.=' <li><a href="'.$inout.($menufunc_url!=""?$menufunc_url:$menu_suffurl).'"><translate>'.$showfunc.'</translate></a></li>' ;  //电脑
		
		if($menulistar==1){ //允许列文章
			$menuar_sql="SELECT * FROM ls_article   where functionName='".$menufunc."' and enable=1 order by Num desc";
			$menuar_query=$opendb->query($menuar_sql);
			$menuar_num=mysqli_num_rows($menuar_query); //总数
			$cateurl1=funccatear1($menufunc);	//大类下1篇文章
			if($menuar_num!=0 &&  $cateurl1==">1" ){ // >1篇
		 		 include "_ls_menu_article.php" ; 
			}
		}
	}else{  //大类有中类

		$menu_mainpc.= '            <li class="dropdown"> <a href="javascript:void(0)" class="dropdown-toggle blue" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">'.$showfunc.'<span class="caret"></span></a><ul class="protit dropdown-menu"  >'; //主菜单（横向）大类，电脑

		while($menucate_rows=mysqli_fetch_assoc($menucate_query))
		{
			$cateurl1=funccatear1($menufunc,$menucate_rows['cateName']);	//大类下1篇文章

			$catefolder=$menucate_rows['folder'];
			$menulistar=$menucate_rows['hotLines'];//菜单是否列出文章标题

			$menucate_url=$menucate_rows['typeurl'];

			$catefilename=( $menucate_url==""?str_replace(".",$menucate_rows['ID'].".",$menufunc_url):$menucate_url);

			$catefilename=$cateurl1!=">1"?$cateurl1:$catefilename; //1篇文章跳过列表页
			$menu_mainpc.= '<li><a href="'.$inout.$catefilename.'" ><span class="glyphicon glyphicon-play"></span><translate>'.$menucate_rows['cateName'].'</translate></a>'; //中类，电脑
			if($menulistar==1){ //允许列文章

				$menuar_sql="SELECT * FROM ls_article   where cateName='".$menucate_rows['cateName']."'   and enable=1 order by Num desc";

				$menuar_query=$opendb->query($menuar_sql);

				$menuar_num=mysqli_num_rows($menuar_query); //总数

				$cateurl1=funccatear1($menufunc,$menucate_rows['cateName']);	//中类下1篇文章

				if($menuar_num!=0  && $cateurl1==">1" ){ //有文章且不是1
					include "_ls_menu_article.php" ; 
				}
			}
		}
		$menu_mainpc.= '</ul></li>';
	}

}else{ //产品菜单

	if($ProMenuStyle=="Horizontal") {  $menu_mainpc.= '{ls_s_cate}';	  } // 大类横在主菜单,中类下拉
	else
	{$menu_mainpc.= '    <li class="dropdown"> <a href="../prolist.html" class="dropdown-toggle blue" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">'.$menufunc.'<span class="caret"></span></a>{ls_s_cate}  </li>';	}

}

?>