<?php

//1、大类横在主菜单，中类下拉菜单 56 public  {ls_s_cate}。支持产品在菜单类别下列出，如存在文件 _menu_product_down_pro.php
//2、页脚菜单 {ls_d_cate} $d_pro_cate  

 $s_pro_cate="";
	$x = $pro_num;
	$y = 0;
	//$oldcatename= $oldpropath? "index.html" :"";
	while($pro_cate_rows=mysqli_fetch_assoc($pro_cate_query))
	{
	  //$oldcatename= $oldpropath? "index.html" :$pro_cate_rows['cateFolders'].".html";
	  $y++;
	  $pro_midcate_sql="select * from ls_products where cateName is null and subcateName is null and subcateFolders is null and subcateBrief is null and subcateID is null and productPic is null and productItemNo is null and productName is null and productSpecification is null and productID is null and enable=1 and midcateID=".$pro_cate_rows['ID']." order by Num asc";
	  $pro_midcate_query=$opendb->query($pro_midcate_sql);
	  $pro_midcate_num=mysqli_num_rows($pro_midcate_query);
	  $detailsfile=$ifcatelink?"../".$pro_cate_rows['cateFolders']."/".($oldcatepath?$pro_cate_rows['cateFolders'].".html":$menucatename):"javascript:void(01)";//22-4-19.html".$pro_cate_rows['cateFolders']."  $menucatename beidou
//$detailsfile=$ifcatelink?"../".$pro_cate_rows['cateFolders']."/".$oldcatename:"javascript:void(01)";
	  $detailsfile2="../".$templates_var."/catedetail.html";
	  if($pro_midcate_num==0)//大类无中类
	  {
		//$s_pro_cate.="&nbsp;<img src='../Templates/images/cate.gif' border='0'> \n";
		//$s_pro_cate.="\n<dt>".$pro_cate_rows['cateName']."</dt>";
		  $myproid=$pro_cate_rows['ID'];
		  $cateurl1= catepro1($myproid);//大类下1个产品
		  $detailsfile=$cateurl1!=">1"?$cateurl1:$detailsfile; //1个产品跳过列表页
		 // $s_pro_cate.="<li class=\"pingputwo\"><a href='".$detailsfile."'><translate>".$pro_cate_rows['cateName']."</translate></a>";
		  $s_pro_cate.=" <li class='dropdown'> <a href='".$detailsfile."' class='dropdown-toggle blue' data-toggle='dropdown' role='button' aria-haspopup='true' aria-expanded='false'><translate>".$pro_cate_rows['cateName']."</translate><span class='caret'></span></a> ";
		  $mycatefolder="../".$pro_cate_rows['cateFolders']."/";
		  //产品列表					  
		 if($ifmenupro)file_exists("_menu_product_down_pro.php")?include "_menu_product_down_pro.php":""; 
		// $s_pro_cate.="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
	  } 
	  else//大类中类
	  {
		//$s_pro_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/cate.gif' border='0'> \n";  //大类引导图
		//if(file_exists($detailsfile2)){
			//../{ls_addprolink}
			//$s_pro_cate.="\n<li class=\"menu-item\"><a href='".$detailsfile."' ><translate>".$pro_cate_rows['cateName']."</translate></a><ul class=\"list-unstyled\" id=\"content".$pro_cate_rows['ID']."\" >";
			 $s_pro_cate.=" <li class='dropdown'> <a href='".$detailsfile."' class='dropdown-toggle blue' data-toggle='dropdown' role='button' aria-haspopup='true' aria-expanded='false'><translate>".$pro_cate_rows['cateName']."</translate><span class='caret'></span></a> ";
		/*}else{
			$s_pro_cate.="\n<li class=\"menu-item\"><a href='javascript:void(01)' onclick=\"turnit(".$pro_cate_rows['ID'].",".$pro_cate_rows['ID'].");this.href=this.href+'?menuId='+".$pro_cate_rows['ID']."+'&cate='+".$pro_cate_rows['ID'].";\" ><translate>".$pro_cate_rows['cateName']."</translate></a><ul class=\"list-unstyled\" id=\"content".$pro_cate_rows['ID']."\" >";
			
		}*/
		//？ 不应该有$s_pro_cate.="\n <div class=\"cate_list\">\n";
		$s_pro_cate.="<ul class=\"protit dropdown-menu pingpu\">"; //中类菜单样式
		while($pro_midcate_rows=mysqli_fetch_assoc($pro_midcate_query))
		{
			$pro_subcate_sql="select * from ls_products where midcateName is null and cateName is null and cateFolders is null and catePagePic is null and catePagePicWidth is null and catePagePicHeight is null and cateBrief is null and productPic is null and productItemNo is null and productName is null and productSpecification is null and productID is null and enable=1 and subcateID=".$pro_midcate_rows['ID']." order by Num asc";
			$pro_subcate_query=$opendb->query($pro_subcate_sql);
			$pro_subcate_num=mysqli_num_rows($pro_subcate_query);
			$mdetailsfile="../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".($oldcatepath?$pro_midcate_rows['midcateFolders'].".html":$menucatename);	//22-4-19					
			$myproid=$pro_midcate_rows['ID'];
		    $cateurl1= catepro1($myproid);//中类下1个产品
		    $mdetailsfile=$cateurl1!=">1"?$cateurl1:$mdetailsfile; //1个产品跳过列表页
			if($pro_subcate_num==0)//没小类
			{
				//$s_pro_cate.="\n<li class=\"menu-item\"><a href='".$mdetailsfile."' onclick=\"turnit(".$pro_cate_rows['ID'].",".$pro_cate_rows['ID'].");this.href=this.href+'?menuId='+".$pro_cate_rows['ID']."+'&cate='+".$pro_cate_rows['ID'].";\"><translate>".$pro_midcate_rows['midcateName']."</translate></a>"; //".$pro_midcate_rows['midcateFolders'].".html
				$s_pro_cate.="<li class=\"pingputwo\"><a href='".$mdetailsfile."'><translate>".$pro_midcate_rows['midcateName']."</translate></a>";

				
				$mycatefolder="../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/";	
				//产品列表				
		  		  if($ifmenupro)file_exists("_menu_product_down_pro.php")?include "_menu_product_down_pro.php":""; 
		  		$s_pro_cate.="</li>";
			}
			else//有小类
			{
			//$s_pro_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n"; //中类引导图
			//$mdetailsfile=$mdetailsfile.".$pro_midcate_rows['midcateName'].".html
				if(file_exists($detailsfile))
				{
					//$s_pro_cate.="<li class=\"menu-item\"><a href='".$mdetailsfile."'><translate>".$pro_midcate_rows['midcateName']."<translate></a><ul>";
					$s_pro_cate.="\n<li class=\"menu-item\"><a href='".$mdetailsfile."'><translate>".$pro_midcate_rows['midcateName']."</translate></a><ul class=\"list-unstyled\" id=\"content".$pro_midcate_rows['ID']."\" >";
				}
				else
				{
					//$s_pro_cate.="\n<li class=\"menu-item\"> <a href='javascript:void(0)' ><span class=\"glyphicon\"></span> <translate>".$pro_midcate_rows['midcateName']."</translate></a>\n<ul class=\"sub-menu2\">\n";
					$s_pro_cate.="\n<li class=\"menu-item\"><a href='javascript:void(01)' onclick=\"turnit(".$pro_midcate_rows['ID'].",".$pro_midcate_rows['ID'].");this.href=this.href+'?menuId='+".$pro_midcate_rows['ID']."+'&midcate='+".$pro_midcate_rows['ID'].";\" ><translate>".$pro_midcate_rows['midcateName']."</translate></a><ul class=\"list-unstyled\" id=\"content".$pro_midcate_rows['ID']."\" >";
				
				} //glyphicon-forward
				//$s_pro_cate.="<div class=\"subcate_list\">";//小类菜单样式
				while($pro_subcate_rows=mysqli_fetch_assoc($pro_subcate_query))		//小类生成
				 {
					$sdetailsfile="../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".$pro_subcate_rows['subcateFolders']."/".($oldcatepath?$pro_subcate_rows['subcateFolders'].".html":$menucatename)	; //22-4-19
					$myproid=$pro_subcate_rows['ID'];
					$cateurl1= catepro1($myproid);//小类下1个产品
					//echo $sdetailsfile;  
					$sdetailsfile=$cateurl1!=">1"?$cateurl1:$sdetailsfile; //1个产品跳过列表页
					$s_pro_cate.="<li class=\"menu-item-3\"> <a href=\"".$sdetailsfile."\" ><translate>".$pro_subcate_rows['subcateName']."</translate></a>\n"; //".$pro_subcate_rows['subcateFolders'].".html
					$mycatefolder="../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".$pro_subcate_rows['subcateFolders']."/";	
					//file_exists("_menu_product_down_pro.php")?include "_menu_product_down_pro.php":""; //产品列表
					$s_pro_cate.="</li>";
				 }
				$s_pro_cate.="</ul>\n</li>\n\n"; 
				} 
			}
			$s_pro_cate.="</ul>\n\n"; 
	  }//if($pro_midcate_num==0)//dalei
		$s_pro_cate.="</li>";
	}
	 $s_pro_cate.="";

?>

