<?php
// 产品侧边栏菜单 536 public {ls_p_cate} 

	$s_p_cate="<ul id=\"pro-menu\" class=\"no-responsive list-group\">";
	$x = $p_num;
	$y = 0;
	while($p_cate_rows=mysql_fetch_assoc($p_cate_query))
	{
	  $detailsfile = "";
	  $y++;
	  $p_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=".$p_cate_rows['ID']." order by Num asc";
	  $p_midcate_query=$opendb->query($p_midcate_sql);
	  $p_midcate_num=mysql_num_rows($p_midcate_query);
	  
	  if($p_midcate_num==0)//大类
	  {
		//$s_p_cate.="&nbsp;<img src='../Templates/images/cate.gif' border='0'> \n";
		//$s_p_cate.="\n<dt>".$p_cate_rows['cateName']."</dt>";

		 // $s_p_cate.="<li class=\"list-group-item side-pro-list-item\"><a href='../".$p_cate_rows['cateFolders']."/".$p_cate_rows['cateFolders'].".html'> <translate>".$p_cate_rows['cateName']."</translate></a></li>";
		$s_p_cate.="<li class=\"list-group-item side-pro-list-item\"><a href='../".$p_cate_rows['cateFolders']."/'> <translate>".$p_cate_rows['cateName']."</translate></a></li>";
		//".$p_cate_rows['cateFolders'].".html $s_p_cate.="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
	  } 
	  else//大类中类
	  {
		//$s_p_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/cate.gif' border='0'> \n";  //大类引导图
		
		$detailsfile="../".$p_cate_rows['cateFolders']."/"; //".$p_cate_rows['cateFolders'].".html

		$detailsfile2="../".$templates_var."/catedetail.html";
		if(file_exists($detailsfile2)){
			//".$detailsfile."
			$s_p_cate.="\n<li class=\"list-group-item side-pro-list-item\"><a href='".$detailsfile."' > <translate>".$p_cate_rows['cateName']."</translate></a><ul class=\"list-unstyled\" id=\"content".$p_cate_rows['ID']."\" >";
		}else{
			$s_p_cate.="\n<li class=\"list-group-item side-pro-list-item\"><a href='".$detailsfile."'  > <translate>".$p_cate_rows['cateName']."</translate></a><ul class=\"list-unstyled\" id=\"content".$p_cate_rows['ID']."\" >";
		}
		
		// onclick=\"turnit(".$p_cate_rows['ID'].",".$p_cate_rows['ID'].");this.href=this.href+'?menuId='+".$p_cate_rows['ID']."+'&cate='+".$p_cate_rows['ID'].";\" ？ 不应该有$s_p_cate.="\n <div class=\"cate_list\">\n";
		while($p_midcate_rows=mysql_fetch_assoc($p_midcate_query))
		{
			$p_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=".$p_midcate_rows['ID']." order by Num asc";
			$p_subcate_query=$opendb->query($p_subcate_sql);
			$p_subcate_num=mysql_num_rows($p_subcate_query);

			//$s_p_cate.="<div class=\"midcate_list\">"; //中类菜单样式
	
			if($p_subcate_num==0)//没小类
			{
				$s_p_cate.="\n<li  class=\"list-group-item side-pro-list-item\"><a href='../".$p_cate_rows['cateFolders']."/".$p_midcate_rows['midcateFolders']."/' > <translate>".$p_midcate_rows['midcateName']."</translate></a></li>";
				//".$p_midcate_rows['midcateFolders'].".html onclick=\"turnit(".$p_cate_rows['ID'].",".$p_cate_rows['ID'].");this.href=this.href+'?menuId='+".$p_cate_rows['ID']."+'&cate='+".$p_cate_rows['ID'].";\"
			}
			else//有小类
			{
			//$s_p_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n"; //中类引导图
			$detailsfile="../".$p_cate_rows['cateFolders']."/".$p_midcate_rows['midcateName']."/"; //".$p_midcate_rows['midcateName'].".html
			if(file_exists($detailsfile))
			{$s_p_cate.="<a href='".$detailsfile."'><translate>".$p_midcate_rows['midcateName']."</translate></a>";}
			else
			{$s_p_cate.="\n<li  class=\"list-group-item side-pro-list-item\"> <a href='".$detailsfile."' > <translate>".$p_midcate_rows['midcateName']."</translate></a>\n<ul class=\"sub-menu\">\n";}
			//$s_p_cate.="<div class=\"subcate_list\">";//小类菜单样式
			while($p_subcate_rows=mysql_fetch_assoc($p_subcate_query))		//小类生成
			 {
				$s_p_cate.="<li> <a href=\"../".$p_cate_rows['cateFolders']."/".$p_midcate_rows['midcateFolders']."/".$p_subcate_rows['subcateFolders']."/\" ><translate>".$p_subcate_rows['subcateName']."</translate></a></li>\n";
				//".$p_subcate_rows['subcateFolders'].".html
			 }
			$s_p_cate.="</ul>\n</li>\n"; 
			} 
		}
		$s_p_cate.="</ul>";
	  }//if($p_midcate_num==0)//dalei
	
	}
	$s_p_cate.="\n </ul>";
			
?>
