<?php
	require_once('_approot.php');	
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<link href="css/admin.css" rel="stylesheet" type="text/css">
		<title>无标题文档</title>
	</head>

	<body>
		<table width="96%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#6396d6">
			<tr>
				<td height="18" background="images/admin_bg.gif"><div align="center"><font color="#ffffff"><strong>模板管理</strong></font></div>
				</td>
			</tr>
			<tr>
				<td height="213" valign="top" bgcolor="#dee7ff"><br>
					<table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
				<tr bgcolor="#B9DAFF">
							<td style="padding-left:10px;" >
								
<?php
	$ls=$_GET['ls'];
	$cateid=$_GET['cateid'];
	$cateFolders=$_GET['cateFolders'];
	$midcateid=$_GET['midcateid'];
	$midcateFolders=$_GET['midcateFolders'];
	$subcateid=$_GET['subcateid'];
	$subcateFolders=$_GET['subcateFolders'];

	$tem_sql="select * from ls_config order by ID";	
	$tem_query=$opendb->query($tem_sql);
	$row=mysqli_fetch_array($tem_query);
	$templates_var = $row['templates'];
	echo $templates_var;
	
	//主菜单 start
	$menu_sql="select * from ls_menu where enable=1 order by menuNum desc";
	$menu_query=$opendb->query($menu_sql);
	$i=1;
	while ($menu_rows=mysqli_fetch_assoc($menu_query))
	{
	  if($i==1)
	  {
	  		$menu.="<a href=\"".$menu_rows['menuLink']."\">".$menu_rows['menuName']."</a>";
	  }
	  else
	  {	
	  	if($menu_rows['menuLink']=="products.html")
	  	{
	  		$menu.="&nbsp;|&nbsp;<a href=\"search.php\">".$menu_rows['menuName']."</a>";
	  	}
	  	else
	  	{
				$menu.="&nbsp;|&nbsp;<a href=\"".$menu_rows['menuLink']."\">".$menu_rows['menuName']."</a>";
	  	}
	  }	
	  $i++;
	}
	//主菜单 end
	
	//主菜单 start
	$menu_pro_sql="select * from ls_menu where enable=1 order by menuNum desc";
	$menu_pro_query=$opendb->query($menu_pro_sql);
	$i=1;
	while ($menu_pro_rows=mysqli_fetch_assoc($menu_pro_query))
	{
	  if($i==1)
	  {
	  	
	  		$menu_pro.="<a href=\"../".$menu_pro_rows['menuLink']."\">".$menu_pro_rows['menuName']."</a>";
	  }
	  else
	  {	
	  	if($menu_pro_rows['menuLink']=="products.html")
	  	{
	  		$menu_pro.="&nbsp;|&nbsp;<a href=\"../search.php\">".$menu_pro_rows['menuName']."</a>";
	  	}
	  	else
	  	{
				$menu_pro.="&nbsp;|&nbsp;<a href=\"../".$menu_pro_rows['menuLink']."\">".$menu_pro_rows['menuName']."</a>";
	  	}
	  }	
	  $i++;
	}
	//主菜单 end
	
		//主菜单 start
	$menu_pro2_sql="select * from ls_menu where enable=1 order by menuNum desc";
	$menu_pro2_query=$opendb->query($menu_pro2_sql);
	$i=1;
	while ($menu_pro2_rows=mysqli_fetch_assoc($menu_pro2_query))
	{
	  if($i==1)
	  {
	  	
	  		$menu_pro2.="<a href=\"../../".$menu_pro2_rows['menuLink']."\">".$menu_pro2_rows['menuName']."</a>";
	  }
	  else
	  {	
	  	if($menu_pro2_rows['menuLink']=="products.html")
	  	{
	  		$menu_pro2.="&nbsp;|&nbsp;<a href=\"../../search.php\">".$menu_pro2_rows['menuName']."</a>";
	  	}
	  	else
	  	{
				$menu_pro2.="&nbsp;|&nbsp;<a href=\"../../".$menu_pro2_rows['menuLink']."\">".$menu_pro2_rows['menuName']."</a>";
	  	}
	  }	
	  $i++;
	}
	//主菜单 end
	
	//主菜单 start
	$menu_pro3_sql="select * from ls_menu where enable=1 order by menuNum desc";
	$menu_pro3_query=$opendb->query($menu_pro3_sql);
	$i=1;
	while ($menu_pro3_rows=mysqli_fetch_assoc($menu_pro3_query))
	{
	  if($i==1)
	  {
	  	
	  		$menu_pro3.="<a href=\"../../../".$menu_pro3_rows['menuLink']."\">".$menu_pro3_rows['menuName']."</a>";
	  }
	  else
	  {	
	  	if($menu_pro3_rows['menuLink']=="products.html")
	  	{
	  		$menu_pro3.="&nbsp;|&nbsp;<a href=\"../../../search.php\">".$menu_pro3_rows['menuName']."</a>";
	  	}
	  	else
	  	{
				$menu_pro3.="&nbsp;|&nbsp;<a href=\"../../../".$menu_pro3_rows['menuLink']."\">".$menu_pro3_rows['menuName']."</a>";
	  	}
	  }	
	  $i++;
	}
	//主菜单 end
	
	//左侧产品类别 Start
	$cate_sql="select * from ls_products where 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 order by Num desc";
	$cate_query=$opendb->query($cate_sql);
	while($cate_rows=mysqli_fetch_assoc($cate_query))
	{
		$subcate_sql="select * from ls_products where 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=".$cate_rows['ID']." order by Num desc";
		$subcate_query=$opendb->query($subcate_sql);
		$subcate_num=mysqli_num_rows($subcate_query); 
		$cate.="<div class=\"catelist\">";
		if($subcate_num==0)
		{
		$cate.="<img src='Templates/images/cate.gif' border='0'> ";
		$cate.="<a href='".$cate_rows['cateFolders']."/index.html' class=\"catea\">
						".$cate_rows['cateName']."
						</a></div>";
		}
		else
		{
		$cate.="<img src='Templates/images/cate2.gif' border='0'> ";
		$cate.="<a href='search.php?cateid=".$cate_rows['ID']."' class=\"catea\">
						".$cate_rows['cateName']."
						</a></div>";
		}
		
		$cate.="<div class=\"xuxian\"></div>";
		while($subcate_rows=mysqli_fetch_assoc($subcate_query))
		 {
			$cate.="<div class=\"subcatelist\">
			<img src='Templates/images/subcate.gif' border='0'>
			<a href=\"".$cate_rows['cateFolders']."/".$subcate_rows['subcateFolders']."/index.html\" class=\"subcatea\">
			".$subcate_rows['subcateName']."
			</a></div>";
		 }
		 
	}
	//左侧产品类别 End
	
	//产品页面左侧产品类别 Start
	$pro_cate_sql="select * from ls_products where 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 order by Num desc";
	$pro_cate_query=$opendb->query($pro_cate_sql);
	while($pro_cate_rows=mysqli_fetch_assoc($pro_cate_query))
	{
		$pro_subcate_sql="select * from ls_products where 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_cate_rows['ID']." order by Num desc";
		$pro_subcate_query=$opendb->query($pro_subcate_sql);
		$pro_subcate_num=mysqli_num_rows($pro_subcate_query); 
		$pro_cate.="<div class=\"catelist\">";
		
		if($pro_subcate_num==0)
		{
		$pro_cate.="<img src='../Templates/".$templates_var."/images/cate.gif' border='0'> ";
		$pro_cate.="<a href='../".$pro_cate_rows['cateFolders']."/index.html' class=\"catea\">
						".$pro_cate_rows['cateName']."
						</a></div>
					";
		}
		else
		{
		$pro_cate.="<img src='../Templates/".$templates_var."/images/cate2.gif' border='0'> ";
		$pro_cate.="<a href='../search.php?cateid=".$pro_cate_rows['ID']."' class=\"catea\">
						".$pro_cate_rows['cateName']."
						</a></div>
					";
		}
		
		$pro_cate.="<div class=\"xuxian\"></div>";
		while($pro_subcate_rows=mysqli_fetch_assoc($pro_subcate_query))
		 {
			$pro_cate.="<div class=\"subcatelist\">
			<img src='../Templates/".$templates_var."/images/subcate.gif' border='0'>
			<a href=\"../".$pro_cate_rows['cateFolders']."/".$pro_subcate_rows['subcateFolders']."/index.html\" class=\"subcatea\">
			".$pro_subcate_rows['subcateName']."
			</a></div>";
		 }
		 
	}
	//左侧产品页面产品类别 End
	
	//产品页面左侧产品类别 Start
	$pro2_cate_sql="select * from ls_products where 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 order by Num desc";
	$pro2_cate_query=$opendb->query($pro2_cate_sql);
	while($pro2_cate_rows=mysqli_fetch_assoc($pro2_cate_query))
	{
		$pro2_subcate_sql="select * from ls_products where 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=".$pro2_cate_rows['ID']." order by Num desc";
		$pro2_subcate_query=$opendb->query($pro2_subcate_sql);
		$pro2_subcate_num=mysqli_num_rows($pro2_subcate_query); 
		$pro2_cate.="<div class=\"catelist\">";
		if($pro2_subcate_num==0)
		{
		$pro2_cate.="<img src='../../Templates/".$templates_var."/images/cate.gif' border='0'> ";
		$pro2_cate.="<a href='../../".$pro2_cate_rows['cateFolders']."/index.html' class=\"catea\">
						".$pro2_cate_rows['cateName']."
						</a></div>
					";
		}
		else
		{
		$pro2_cate.="<img src='../../Templates/".$templates_var."/images/cate2.gif' border='0'> ";
		$pro2_cate.="<a href='../../search.php?cateid=".$pro2_cate_rows['ID']."' class=\"catea\">
						".$pro2_cate_rows['cateName']."
						</a></div>
					";
		}
		
		$pro2_cate.="<div class=\"xuxian\"></div>";
		while($pro2_subcate_rows=mysqli_fetch_assoc($pro2_subcate_query))
		 {
			$pro2_cate.="<div class=\"subcatelist\">
			<img src='../../Templates/".$templates_var."/images/subcate.gif' border='0'>
			<a href=\"../../".$pro2_cate_rows['cateFolders']."/".$pro2_subcate_rows['subcateFolders']."/index.html\" class=\"subcatea\">
			".$pro2_subcate_rows['subcateName']."
			</a></div>";
		 }
		 
	}
	//左侧产品页面产品类别 End
	
	//产品页面左侧产品类别showproduct Start
	$pro3_cate_sql="select * from ls_products where 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 order by Num desc";
	$pro3_cate_query=$opendb->query($pro3_cate_sql);
	while($pro3_cate_rows=mysqli_fetch_assoc($pro3_cate_query))
	{
		$pro3_subcate_sql="select * from ls_products where 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=".$pro3_cate_rows['ID']." order by Num desc";
		$pro3_subcate_query=$opendb->query($pro3_subcate_sql);
		$pro3_subcate_num=mysqli_num_rows($pro3_subcate_query); 
		$pro3_cate.="<div class=\"catelist\">";
		if($pro3_subcate_num==0)
		{
		$pro3_cate.="<img src='../../../Templates/".$templates_var."/images/cate.gif' border='0'> ";
		$pro3_cate.="<a href='../../../".$pro3_cate_rows['cateFolders']."/index.html' class=\"catea\">
						".$pro3_cate_rows['cateName']."
						</a></div>
					";
		}
		else
		{
		$pro3_cate.="<img src='../../../Templates/".$templates_var."/images/cate2.gif' border='0'> ";
		$pro3_cate.="<a href='../../../search.php?cateid=".$pro3_cate_rows['ID']."' class=\"catea\">
						".$pro3_cate_rows['cateName']."
						</a></div>
					";
		}
		
		$pro3_cate.="<div class=\"xuxian\"></div>";
		while($pro3_subcate_rows=mysqli_fetch_assoc($pro3_subcate_query))
		 {
			$pro3_cate.="<div class=\"subcatelist\">
			<img src='../../../Templates/".$templates_var."/images/subcate.gif' border='0'>
			<a href=\"../../../".$pro3_cate_rows['cateFolders']."/".$pro3_subcate_rows['subcateFolders']."/index.html\" class=\"subcatea\">
			".$pro3_subcate_rows['subcateName']."
			</a></div>";
		 }
		 
	}
	//左侧产品页面产品类别showproduct End
		
	
	//新闻列表 Statt
	$news_sql="select * from ls_news order by ID desc limit 0,".$newsNum."";	
	$news_query=$opendb->query($news_sql);
	$i=1;
	while($news_rows=mysqli_fetch_assoc($news_query))
	{
		$news.="<div style=\"padding-left:5px;\"><img src='Templates/images/news.gif' border='0'> <a href=\"".$newsshowFolders."/news".$news_rows['ID'].".html\">".$news_rows['newsTitle']."</a>";
		$news.="<div class=\"xuxian\"></div></div>";
		if($i==$newsNum)
		{
		$news.="<div align=\"right\"><a href=\"news.html\">more..</a></div>";
		}
		
		$i++;
	}
	//新闻列表 End
	
	//首页产品展示 Start
	$products_sql="select * from ls_products where cateName is null and cateFolders is null and catePagePic is null and catePagePicWidth is null and catePagePicHeight is null and cateBrief is null and subcateName is null and subcateFolders is null and subcateBrief is null and subcateID is null and enable=1";
	$products_sql.=" order by Num desc limit 0,".$proNum." ";
	$products_query=$opendb->query($products_sql);
	while($products_rows=mysqli_fetch_assoc($products_query))
	{
		$subcate_sql="select * from ls_products where ID=".$products_rows['productID']."";
		$subcate_query=$opendb->query($subcate_sql);
		$subcate_rows=mysqli_fetch_assoc($subcate_query);
		$cate_sql="select * from ls_products where ID=(select subcateID from ls_products where ID=".$products_rows['productID'].")";
		$cate_query=$opendb->query($cate_sql);
		$cate_rows=mysqli_fetch_assoc($cate_query);
		if($subcate_rows['subcateFolders']=="")
		{
		$prosrc=$subcate_rows['cateFolders']."/".$SmallFoldersProducts."/".$products_rows['productPic'];
		$prolink=$subcate_rows['cateFolders']."/".$showproductsFolders."/".trim(str_replace(substr($products_rows['productPic'],-4),"",$products_rows['productPic'])).".html";
		
		}
		else
		{
		$prosrc=$cate_rows['cateFolders']."/".$subcate_rows['subcateFolders']."/".$SmallFoldersProducts."/".$products_rows['productPic'];
		$prolink=$cate_rows['cateFolders']."/".$subcate_rows['subcateFolders']."/".$showproductsFolders."/".trim(str_replace(substr($products_rows['productPic'],-4),"",$products_rows['productPic'])).".html";
		
		}
		$hotpro.="<div class=\"hotpro2\">";
		$hotpro.="<div class=\"hotpro\" >";
		$hotpro.="<a href=\"".$prolink."\" target=\"_ablank\"><img src=".$prosrc." border=\"0\" alt=\"".$products_rows['productName']."\"></a>";
		$hotpro.="</div>";
		$hotpro.="<div class=\"hotpro3\" ><a href=\"".$prolink."\">".$products_rows['productName']."</a></div>";
		$hotpro.="</div>";
		
	}																		
	//首页产品展示 End
	
	//底部信息 Start
	$config_sql="select * from ls_config ";
	$config_query=$opendb->query($config_sql);
	$config_row=mysqli_fetch_assoc($config_query);
	
	$foot="Address:".$config_row['address']."<br>";
	$foot.="Tel:".$config_row['tel']."&nbsp;";
	$foot.="&nbsp;Fax:".$config_row['fax']."&nbsp;";
	$foot.="&nbsp;E-Mail:<a href=\"mailto:".$config_row['email']."\">".$config_row['email']."</a>&nbsp;";
	//底部信息 End
	$about=substr_cut($config_row['aboutus'],$aboutLength)." <a href=\"aboutus.html\">more &gt;&gt;</a></p>";
	$allabout=$config_row['aboutus'];
	
			
			
			
	
	
	
		
		  //生成首页
			$ms1="正在生成首页...";
			$index_path="../".$templates_var."/index.html";//首页模板地址
			$ls_title=$config_row['siteKeywords']."_".$config_row['companyName'];//首页title
			$ls_keywords=$config_row['siteKeywords'];	//首页Keywords
			$ls_description=$config_row['siteDescription'];//首页Description
			$ls_cate=$cate;			//左侧产品类别
			$ls_menu=$menu;			//主菜单
			$ls_about=$about;		//首页About us
			$ls_news=$news;			//首页News
			$ls_classpro=$classpro;		//类别 products
			$ls_hotpro=$hotpro;		//首页 Hot products
			$ls_foot=$foot;			//底部信息
			
			$fp	   = fopen ($index_path,"r");
		  $content  = fread ($fp,filesize ($index_path));
		  $content  = str_replace ("{ls_title}",$ls_title,$content);
		  $content  = str_replace ("{ls_keywords}",$ls_keywords,$content);
			$content  = str_replace ("{ls_description}",$ls_description,$content);
			$content  = str_replace ("{ls_menu}",$ls_menu,$content);
			$content	= str_replace ("{ls_about}",$ls_about,$content);
			$content	= str_replace ("{ls_news}",$ls_news,$content);
			$content  = str_replace ("{ls_cate}",$ls_cate,$content);
			$content  = str_replace ("{ls_classpro}",$ls_classpro,$content);
			$content  = str_replace ("{ls_hotpro}",$ls_hotpro,$content);
			$content  = str_replace ("{ls_foot}",$ls_foot,$content);
			
			$filename = "../index.html"; //生成文件地址
		  
		   $handle   = fopen ($filename,"w"); //打开文件指针，
		  /*
		　检查文件是否被创建且可写
		  */
		  if (!is_writable ($filename))
		  	{ 
					 echo "<script>alert('文件：".$filename."不可写，请检查其属性后重试！');history.go(-1);</script>";
			  }
		  if (!fwrite ($handle,$content))
		  	{  //将信息写入文件
			  	echo "<script>alert('生成文件".$filename."失败！');history.go(-1);</script>";
			  } 
				  fclose ($handle); //关闭指针
				 	  //die ("创建首页<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\">返回</a>");
			fclose ($fp);
	 		$ms1="创建首页<a href='".$filename."'>".$filename."</a>成功！";
			echo "<li>".$ms1."</li>";
	 
		//生成 About us
			$ms2="正在生成About us...";
			
			$index_path="../".$templates_var."/aboutus.html";//模板地址
			$ls_title=$config_row['companyName'];	//title
			$ls_keywords=$config_row['siteKeywords'];	//Keywords
			$ls_description=$config_row['siteDescription'];//Description
			$ls_cate=$cate;																								//左侧产品类别
			$ls_menu=$menu;																								//主菜单
			$ls_allabout=$allabout ;																			//About us
			$ls_foot=$foot;																								//底部信息
			
			$fp	   = fopen ($index_path,"r");
		  $content  = fread ($fp,filesize ($index_path));
		  $content  = str_replace ("{ls_title}",$ls_title,$content);
		  $content  = str_replace ("{ls_keywords}",$ls_keywords,$content);
			$content  = str_replace ("{ls_description}",$ls_description,$content);
			$content  = str_replace ("{ls_menu}",$ls_menu,$content);
			$content	= str_replace ("{ls_allabout}",$ls_allabout,$content);
			$content  = str_replace ("{ls_cate}",$ls_cate,$content);
			$content  = str_replace ("{ls_foot}",$ls_foot,$content);
			
			$filename = "../aboutus.html"; //生成文件地址
		  
		   $handle   = fopen ($filename,"w"); //打开文件指针，
		  /*
		　检查文件是否被创建且可写
		  */
		  if (!is_writable ($filename))
		  	{ 
					 echo "<script>alert('文件：".$filename."不可写，请检查其属性后重试！');history.go(-1);</script>";
			  }
		  if (!fwrite ($handle,$content))
		  	{  //将信息写入文件
			  	echo "<script>alert('生成文件".$filename."失败！');history.go(-1);</script>";
			  } 
				  fclose ($handle); //关闭指针
				 	  //die ("创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\">返回</a>");
			fclose ($fp);
			 	$ms2="创建<a href='".$filename."'>".$filename."</a>成功！";	
 			echo "<li>".$ms2."</li>";
   //生成 feedback
			$ms3="正在生成 feedback...";
			$index_path="../".$templates_var."/feedback.html";//模板地址
			$ls_title=$config_row['companyName'];//title
			$ls_keywords=$config_row['siteKeywords'];	//Keywords
			$ls_description=$config_row['siteDescription'];//Description
			$ls_cate=$cate;																								//左侧产品类别
			$ls_menu=$menu;																								//主菜单
			$ls_feedback=$config_row['email'] ;//E-Mail
			$ls_foot=$foot;																								//底部信息
			
			$fp	   = fopen ($index_path,"r");
		  $content  = fread ($fp,filesize ($index_path));
		  $content  = str_replace ("{ls_title}",$ls_title,$content);
		  $content  = str_replace ("{ls_keywords}",$ls_keywords,$content);
			$content  = str_replace ("{ls_description}",$ls_description,$content);
			$content  = str_replace ("{ls_menu}",$ls_menu,$content);
			$content	= str_replace ("{ls_feedback}",$ls_feedback,$content);
			$content  = str_replace ("{ls_cate}",$ls_cate,$content);
			$content  = str_replace ("{ls_foot}",$ls_foot,$content);
			
			$filename = "../feedback.html"; //生成文件地址
		  
		   $handle   = fopen ($filename,"w"); //打开文件指针，
		  /*
		　检查文件是否被创建且可写
		  */
		  if (!is_writable ($filename))
		  	{ 
					 echo "<script>alert('文件：".$filename."不可写，请检查其属性后重试！');history.go(-1);</script>";
			  }
		  if (!fwrite ($handle,$content))
		  	{  //将信息写入文件
			  	echo "<script>alert('生成文件".$filename."失败！');history.go(-1);</script>";
			  } 
				  fclose ($handle); //关闭指针
				 	  //die ("创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\">返回</a>");
	fclose ($fp);
	$ms3="创建<a href='".$filename."'>".$filename."</a>成功！";
	echo "<li>".$ms3."</li>";
	 
	 
	 //case "contactus":  //生成 contact us
			$ms4="正在生成 contact us...";
			$contactus.="Address:".$config_row['address']."<br>";
			$contactus.="Tel:".$config_row['tel']."<br>";
			$contactus.="Fax:".$config_row['fax']."<br>";
			$contactus.="E-Mail:<a href=\"mailto:".$config_row['email']."\">".$config_row['email']."</a><br>";
			$contactus.="MSN:<a href=\"mailto:".$config_row['MSN']."\">".$config_row['MSN']."</a><br>";
			$contactus.="URL:<a href=\"http://".$config_row['website']."\">".$config_row['website']."</a><br>";
			$contactus.="
			<div><iframe width=\"425\" height=\"350\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" src=\"http://maps.google.com/maps?f=q&amp;hl=en&amp;geocode=&amp;time=&amp;date=&amp;ttype=&amp;q=shijiazhuang&amp;ie=UTF8&amp;om=0&amp;ll=40.010787,115.576172&amp;spn=4.057083,9.887695&amp;z=6&amp;output=embed&amp;s=AARTsJqjog8iSBSLNjlPFxYG9xF3Pr6KtA\"></iframe></div>
				<div>
						It is about 270 Kilomaters from Beijing to Shijiazhuang, 3 hours by car. <br>
						<br>
			It is about 280 Kilomaters from Tianjin to Shijiazhuang, 4 hours by car. <br>
			<br>
		   		Shijiazhuang, capital of Hebei Province, is situated 270 kilometers southwest 
			  of Beijing. Bordering the Taihang Mountains in the west, it faces 
			  the vast and rich North China Plain on its three other sides. It 
			  is the intersection of the Beijing-Guangzhou, Shijiazhuang -Dezhou, 
			  and Shijiazhuang-Taiyuan railway lines and one of the centers of 
			  communications in China. It encompasses 15,653 square kilometres, 
			  has a population of 8.75 million. 
				</div>
						";
						
			$index_path="../".$templates_var."/contact.html";//模板地址
			$ls_title=$config_row['companyName'];//title
			$ls_keywords=$config_row['siteKeywords'];	//Keywords
			$ls_description=$config_row['siteDescription'];//Description
			$ls_cate=$cate;																								//左侧产品类别
			$ls_menu=$menu;																								//主菜单
			$ls_contactus=$contactus ;																			//contact us
			$ls_foot=$foot;																								//底部信息
			
			$fp	   = fopen ($index_path,"r");
		  $content  = fread ($fp,filesize ($index_path));
		  $content  = str_replace ("{ls_title}",$ls_title,$content);
		  $content  = str_replace ("{ls_keywords}",$ls_keywords,$content);
			$content  = str_replace ("{ls_description}",$ls_description,$content);
			$content  = str_replace ("{ls_menu}",$ls_menu,$content);
			$content	= str_replace ("{ls_contactus}",$ls_contactus,$content);
			$content  = str_replace ("{ls_cate}",$ls_cate,$content);
			$content  = str_replace ("{ls_foot}",$ls_foot,$content);
			
			$filename = "../contact.html"; //生成文件地址
		  
		   $handle   = fopen ($filename,"w"); //打开文件指针，
		  /*
		　检查文件是否被创建且可写
		  */
		  if (!is_writable ($filename))
		  	{ 
					 echo "<script>alert('文件：".$filename."不可写，请检查其属性后重试！');history.go(-1);</script>";
			  }
		  if (!fwrite ($handle,$content))
		  	{  //将信息写入文件
			  	echo "<script>alert('生成文件".$filename."失败！');history.go(-1);</script>";
			  } 
				  fclose ($handle); //关闭指针
				 	  //die ("创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\">返回</a>");
		fclose ($fp);
		$ms4="创建<a href='".$filename."'>".$filename."</a>成功！";
		echo "<li>".$ms4."</li>";
	

	
	//case "news": //生成新闻 News
	  $ms6="正在生成新闻 News...";
	  $news_sql="select * from ls_news order by ID desc ";
	  
	  $result=$opendb->query($news_sql);
		$mynum = mysqli_num_rows($result);//总产品数
		// 每页数量
		$onepage = $PageNum; 
		//共有页数
		$allpages = ceil($mynum/$onepage);
		
		//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			for ($i=0; $i< $allpages; $i++)
			{ 
				if(($allpages-$i-1)==0)
				{
					$indexp="news.html";
				}
				else
				{
					$indexp="news".($allpages-$i-1).".html";
				}
				if($indexp="news.html")
				{
					$propage2.="<div class=\"propage\">&nbsp;</div>";
				}
				else
				{
			 		$propage2.="<div class=\"propage\"><a href=\"".$indexp."\">".($allpages-$i)."</a></div>";
			}
		}
			//页码计算
			
			for ($i=0; $i< $allpages; $i++)
			{ 
			if ($i == 0)
			{ 
			$indexpath = "news.html";
		  } 
		  else 
		  { 
			$indexpath = "news".$i.".html";
		  }
		 $start = $i * $onepage;
		 //查询产品
		 
		 $news_sql.=" limit ".$start.",".$onepage." ";
			 $news_query=$opendb->query($news_sql);
			 while($news_rows=mysqli_fetch_assoc($news_query))
				{
					$newslist.="<div style=\"padding-left:5px;\"><img src='Templates/images/news.gif' border='0'> <a href=\"".$newsshowFolders."/news".$news_rows['ID'].".html\">".$news_rows['newsTitle']."</a>";
					$newslist.="<div class=\"xuxian\"></div></div>";
					
					$newstitle=$news_rows['newsTitle'];
					$newstext=$news_rows['newsText'];
					createFolder("../".$newsshowFolders);
					
					$index_newspath="../".$templates_var."/newsshow.html";//模板地址
					$ls_title=$config_row['companyName'];	//title
					$ls_keywords=$config_row['siteKeywords'];//Keywords
					$ls_description=$config_row['siteDescription'];//Description
					$ls_cate=$pro_cate;																						//左侧产品类别
					$ls_menu=$menu_pro;																						//主菜单
					$ls_newstitle=$newstitle ;																		//新闻标题
					$ls_newstext=$newstext;																				//新闻内容
					$ls_url="../";																									//链接		
					$ls_foot=$foot;																								//底部信息
					
					$fp	   = fopen ($index_newspath,"r");
				  $newscontent  = fread ($fp,filesize ($index_newspath));
				  $newscontent  = str_replace ("{ls_title}",$ls_title,$newscontent);
				  $newscontent  = str_replace ("{ls_keywords}",$ls_keywords,$newscontent);
					$newscontent  = str_replace ("{ls_description}",$ls_description,$newscontent);
					$newscontent  = str_replace ("{ls_menu}",$ls_menu,$newscontent);
					$newscontent  = str_replace ("{ls_cate}",$ls_cate,$newscontent);
					$newscontent	= str_replace ("{ls_propage}",$ls_propage,$newscontent);
					$newscontent	= str_replace ("{ls_newstitle}",$ls_newstitle,$newscontent);
					$newscontent	= str_replace ("{ls_newstext}",$ls_newstext,$newscontent);
					$newscontent	= str_replace ("{ls_url}",$ls_url,$newscontent);
					$newscontent  = str_replace ("{ls_foot}",$ls_foot,$newscontent);
					//echo $newscontent;
					
					$filename="../".$newsshowFolders."/news".$news_rows['ID'].".html";
			
						if (is_file ($filename))
						{ 
					@unlink ($filename); //若文件已存在，则删除
				  }
			
				  $handle   = fopen ($filename,"w"); //打开文件指针，
					  /*
					　检查文件是否被创建且可写
					  */
					 
					  if (!is_writable ($filename))
					  	{ 
								 echo "<script>alert('文件：".$filename."不可写，请检查其属性后重试！');history.go(-1);</script>";
						  }
					  if (!fwrite ($handle,$newscontent))
					  	{  //将信息写入文件
						  	echo "<script>alert('生成文件".$filename."失败！');history.go(-1);</script>";
						  } 
						fclose ($handle); //关闭指针
							 	  //die ("创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\">返回</a>");
						fclose ($fp);
					
				}
				
			$index_path="../".$templates_var."/news.html";  //模板地址
			$ls_title=$config_row['companyName'];	//title
			$ls_keywords=$config_row['siteKeywords'];//Keywords
			$ls_description=$config_row['siteDescription'];//Description
			$ls_cate=$cate;																								//左侧产品类别
			$ls_menu=$menu;																								//主菜单
			$ls_newslist=$newslist ;																			//新闻news 列表
			$ls_propage=$propage2;																					//新闻分页页码
			$ls_foot=$foot;																								//底部信息
			
			$fp	   = fopen ($index_path,"r");
		  $content  = fread ($fp,filesize ($index_path));
		  $content  = str_replace ("{ls_title}",$ls_title,$content);
		  $content  = str_replace ("{ls_keywords}",$ls_keywords,$content);
			$content  = str_replace ("{ls_description}",$ls_description,$content);
			$content  = str_replace ("{ls_menu}",$ls_menu,$content);
			$content  = str_replace ("{ls_cate}",$ls_cate,$content);
			$content	= str_replace ("{ls_propage}",$ls_propage,$content);
			$content	= str_replace ("{ls_newslist}",$ls_newslist,$content);
			$content  = str_replace ("{ls_foot}",$ls_foot,$content);
			
		//	echo $content;
			
			$filename="../".$indexp;
			
			if (is_file ($filename))
			{ 
		@unlink ($filename); //若文件已存在，则删除
	  }

	  $handle   = fopen ($filename,"w"); //打开文件指针，
		  /*
		　检查文件是否被创建且可写
		  */
		  if (!is_writable ($filename))
		  	{ 
					 echo "<script>alert('文件：".$filename."不可写，请检查其属性后重试！');history.go(-1);</script>";
			  }
		  if (!fwrite ($handle,$content))
		  	{  //将信息写入文件
			  	echo "<script>alert('生成文件".$filename."失败！');history.go(-1);</script>";
			  } 
				  fclose ($handle); //关闭指针
				 	  //die ("创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\">返回</a>");
			}
			fclose ($fp);
  		//die ("共有".$mynum."条新闻。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>");
	
	$ms6="创建新闻成功！";
	echo "<li>".$ms6."</li>";
	// break;
	 
//	case "download": //生成下载
		$ms7="正在生成下载 download...";
		$news_sql="select * from ls_download where enable=1 order by ID desc ";
	  $result=$opendb->query($news_sql);
		$mynum = mysqli_num_rows($result);//总产品数
		// 每页数量
		$onepage = $PageNum; 
		//共有页数
		$allpages = ceil($mynum/$onepage);
		
		//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			for ($i=0; $i< $allpages; $i++)
			{ 
				if(($allpages-$i-1)==0)
				{
					$indexp="download.html";
				}
				else
				{
					$indexp="download".($allpages-$i-1).".html";
				}
				if($indexp="download.html")
				{
					$propage3.="<div class=\"propage\">&nbsp;</div>";
				}
				else
				{
			 		$propage3.="<div class=\"propage\"><a href=\"".$indexp."\">".($allpages-$i)."</a></div>";
			}
		}
			//页码计算
			
			for ($i=0; $i< $allpages; $i++)
			{ 
			if ($i == 0)
			{ 
			$indexpath = "download.html";
		  } 
		  else 
		  { 
			$indexpath = "download".$i.".html";
		  }
		 $start = $i * $onepage;
		 //查询产品
		 
		 $news_sql.=" limit ".$start.",".$onepage." ";
			 $news_query=$opendb->query($news_sql);
	
			 while($news_rows=mysqli_fetch_assoc($news_query))
				{
					$downlist.="<div style=\"padding-left:5px;\"><img src='Templates/images/news.gif' border='0'> <a href=\"".$downloadFolders."/".$news_rows['downloadName']."\" title=\"Size:".$news_rows['downloadSize']."KB\">".$news_rows['downloadTitle']."</a> ";
					$downlist.="<div class=\"xuxian\"></div></div>";
				}
				$index_path="../".$templates_var."/download.html"; //模板地址
				$ls_title=$config_row['companyName'];		//title
				$ls_keywords=$config_row['siteKeywords'];//Keywords
				$ls_description=$config_row['siteDescription'];//Description
				$ls_cate=$cate;																								//左侧产品类别
				$ls_menu=$menu;																								//主菜单
				$ls_downlist=$downlist ;																			//新闻news 列表
				$ls_propage=$propage3;																					//新闻分页页码
				$ls_foot=$foot;																								//底部信息
				
				$fp	   = fopen ($index_path,"r");
			  $content  = fread ($fp,filesize ($index_path));
			  $content  = str_replace ("{ls_title}",$ls_title,$content);
			  $content  = str_replace ("{ls_keywords}",$ls_keywords,$content);
				$content  = str_replace ("{ls_description}",$ls_description,$content);
				$content  = str_replace ("{ls_menu}",$ls_menu,$content);
				$content  = str_replace ("{ls_cate}",$ls_cate,$content);
				$content	= str_replace ("{ls_propage}",$ls_propage,$content);
				$content	= str_replace ("{ls_downlist}",$ls_downlist,$content);
				$content  = str_replace ("{ls_foot}",$ls_foot,$content);
				//echo $content;
				$filename="../".$indexp;
			
				if (is_file ($filename))
				{ 
			@unlink ($filename); //若文件已存在，则删除
		  }
	
		  $handle   = fopen ($filename,"w"); //打开文件指针，
			  /*
			　检查文件是否被创建且可写
			  */
			  if (!is_writable ($filename))
			  	{ 
						 echo "<script>alert('文件：".$filename."不可写，请检查其属性后重试！');history.go(-1);</script>";
				  }
			  if (!fwrite ($handle,$content))
			  	{  //将信息写入文件
				  	echo "<script>alert('生成文件".$filename."失败！');history.go(-1);</script>";
				  } 
					  fclose ($handle); //关闭指针
					 	  //die ("创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\">返回</a>");
				}
				fclose ($fp);
	  		
	  		//die ("共有".$mynum."条下载。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>");
	//	break;
		$ms7="创建下载成功！";
echo "<li>".$ms7."</li>";	
//case "management": //生成管理团队(Management)
			$ms8="正在生成管理团队(Management)...";
		$news_sql="select * from ls_management where enable=1 order by Num desc ";
	  $result=$opendb->query($news_sql);
		$mynum = mysqli_num_rows($result);//总产品数
		// 每页数量
		$onepage = $PageNum; 
		//共有页数
		$allpages = ceil($mynum/$onepage);
		
		//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			for ($i=0; $i< $allpages; $i++)
			{ 
				if(($allpages-$i-1)==0)
				{
					$indexp="management.html";
				}
				else
				{
					$indexp="management".($allpages-$i-1).".html";
				}
				if($indexp="management.html")
				{
					$propage4.="<div class=\"propage\">&nbsp;</div>";
				}
				else
				{
			 		$propage4.="<div class=\"propage\"><a href=\"".$indexp."\">".($allpages-$i)."</a></div>";
			}
		}
			//页码计算
			
			for ($i=0; $i< $allpages; $i++)
			{ 
			if ($i == 0)
			{ 
			$indexpath = "management.html";
		  } 
		  else 
		  { 
			$indexpath = "management".$i.".html";
		  }
		 $start = $i * $onepage;
		 //查询产品
		 
		 $news_sql.=" limit ".$start.",".$onepage." ";
			 $news_query=$opendb->query($news_sql);
	
			 while($news_rows=mysqli_fetch_assoc($news_query))
				{
					$list7.="
									<div style=\"border-bottom:1px solid #ccc; width:98%;\">
										<div style=\"float:left;padding-right:10px;\">
											<a href=\"".$WorkShopFolders."/".$BigFoldersProducts."/".$news_rows['Pic']."\" target=\"_ablank\">
												<img src=\"".$WorkShopFolders."/".$SmallFoldersProducts."/".$news_rows['Pic']."\" border=\"0\">
											</a>
										</div>
										<div style=\"float:left;\">
											".$news_rows['Text']."
										</div>
									</div>
									";
				}
				$index_path="../".$templates_var."/management.html";	//模板地址
				$ls_title=$config_row['companyName'];//title
				$ls_keywords=$config_row['siteKeywords'];//Keywords
				$ls_description=$config_row['siteDescription'];//Description
				$ls_cate=$cate;																								//左侧产品类别
				$ls_menu=$menu;																								//主菜单
				$ls_list=$list7 ;																			//新闻news 列表
				$ls_propage=$propage4;																					//新闻分页页码
				$ls_foot=$foot;																								//底部信息
				
				$fp	   = fopen ($index_path,"r");
			  $content  = fread ($fp,filesize ($index_path));
			  $content  = str_replace ("{ls_title}",$ls_title,$content);
			  $content  = str_replace ("{ls_keywords}",$ls_keywords,$content);
				$content  = str_replace ("{ls_description}",$ls_description,$content);
				$content  = str_replace ("{ls_menu}",$ls_menu,$content);
				$content  = str_replace ("{ls_cate}",$ls_cate,$content);
				$content	= str_replace ("{ls_propage}",$ls_propage,$content);
				$content	= str_replace ("{ls_list}",$ls_list,$content);
				$content  = str_replace ("{ls_foot}",$ls_foot,$content);
				//echo $content;
				$filename="../".$indexp;
			
				if (is_file ($filename))
				{ 
			@unlink ($filename); //若文件已存在，则删除
		  }
	
		  $handle   = fopen ($filename,"w"); //打开文件指针，
			  /*
			　检查文件是否被创建且可写
			  */
			  if (!is_writable ($filename))
			  	{ 
						 echo "<script>alert('文件：".$filename."不可写，请检查其属性后重试！');history.go(-1);</script>";
				  }
			  if (!fwrite ($handle,$content))
			  	{  //将信息写入文件
				  	echo "<script>alert('生成文件".$filename."失败！');history.go(-1);</script>";
				  } 
					  fclose ($handle); //关闭指针
					 	  //die ("创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\">返回</a>");
				}
				fclose ($fp);
	  		
	  		//die ("管理团队:共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>");
		
	$ms8="创建管理团队成功！";
	echo "<li>".$ms8."</li>";
	//	break;
		
	//	case "workshop": //生成车间图片(Workshop)
		$ms9="正在生成车间图片(Workshop)...";
		$news_sql="select * from ls_workshop where enable=1 order by Num desc ";
		$result=$opendb->query($news_sql);
		$mynum = mysqli_num_rows($result);//总产品数
		// 每页数量
		$onepage = $PageNum; 
		//共有页数
		$allpages = ceil($mynum/$onepage);
		
		//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			for ($i=0; $i< $allpages; $i++)
			{ 
				if(($allpages-$i-1)==0)
				{
					$indexp="workshop.html";
				}
				else
				{
					$indexp="workshop".($allpages-$i-1).".html";
				}
				if($indexp="workshop.html")
				{
					$propage5.="<div class=\"propage\">&nbsp;</div>";
				}
				else
				{
			 		$propage5.="<div class=\"propage\"><a href=\"".$indexp."\">".($allpages-$i)."</a></div>";
			}
		}
			//页码计算
			
			for ($i=0; $i< $allpages; $i++)
			{ 
			if ($i == 0)
			{ 
			$indexpath = "workshop.html";
		  } 
		  else 
		  { 
			$indexpath = "workshop".$i.".html";
		  }
		 $start = $i * $onepage;
		 //查询产品
		 
		 $news_sql.=" limit ".$start.",".$onepage." ";
			 $news_query=$opendb->query($news_sql);
	
			 while($news_rows=mysqli_fetch_assoc($news_query))
				{
					$list6.="
									<div style=\"border-bottom:1px solid #ccc; width:98%;\">
										<div style=\"float:left;padding-right:10px;\">
											<a href=\"".$WorkShopFolders."/".$BigFoldersProducts."/".$news_rows['workshopPic']."\" target=\"_ablank\">
												<img src=\"".$WorkShopFolders."/".$SmallFoldersProducts."/".$news_rows['workshopPic']."\" border=\"0\">
											</a>
										</div>
										<div style=\"float:left;\">
											".$news_rows['workshopText']."
										</div>
									</div>
									";
				}
				$index_path="../".$templates_var."/workshop.html";//模板地址
				$ls_title=$config_row['companyName'];	//title
				$ls_keywords=$config_row['siteKeywords'];	//Keywords
				$ls_description=$config_row['siteDescription'];//Description
				$ls_cate=$cate;																								//左侧产品类别
				$ls_menu=$menu;																								//主菜单
				$ls_list=$list6 ;																							//新闻news 列表
				$ls_propage=$propage5;																					//新闻分页页码
				$ls_foot=$foot;																								//底部信息
				
				$fp	   = fopen ($index_path,"r");
			  $content  = fread ($fp,filesize ($index_path));
			  $content  = str_replace ("{ls_title}",$ls_title,$content);
			  $content  = str_replace ("{ls_keywords}",$ls_keywords,$content);
				$content  = str_replace ("{ls_description}",$ls_description,$content);
				$content  = str_replace ("{ls_menu}",$ls_menu,$content);
				$content  = str_replace ("{ls_cate}",$ls_cate,$content);
				$content	= str_replace ("{ls_propage}",$ls_propage,$content);
				$content	= str_replace ("{ls_list}",$ls_list,$content);
				$content  = str_replace ("{ls_foot}",$ls_foot,$content);
				//echo $content;
				$filename="../".$indexp;
			
				if (is_file ($filename))
				{ 
			@unlink ($filename); //若文件已存在，则删除
		  }
	
		  $handle   = fopen ($filename,"w"); //打开文件指针，
			  /*
			　检查文件是否被创建且可写
			  */
			  if (!is_writable ($filename))
			  	{ 
						 echo "<script>alert('文件：".$filename."不可写，请检查其属性后重试！');history.go(-1);</script>";
				  }
			  if (!fwrite ($handle,$content))
			  	{  //将信息写入文件
				  	echo "<script>alert('生成文件".$filename."失败！');history.go(-1);</script>";
				  } 
					  fclose ($handle); //关闭指针
					 	  //die ("创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\">返回</a>");
				}
				fclose ($fp);
	  		
	  		//die ("共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>");
			$ms9="创建车间图片成功！";
		echo "<li>".$ms9."</li>";
		//break;
		
		
		//case "qualitycontrol": //生成质量控制管理(Quality Control)
			$ms10="正在生成质量控制(Quality Control)...";
		$news_sql="select * from ls_qualitycontrol where enable=1 order by Num desc ";
	  $result=$opendb->query($news_sql);
		$mynum = mysqli_num_rows($result);//总产品数
		// 每页数量
		$onepage = $PageNum; 
		//共有页数
		$allpages = ceil($mynum/$onepage);
		
		//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			for ($i=0; $i< $allpages; $i++)
			{ 
				if(($allpages-$i-1)==0)
				{
					$indexp="quality.html";
				}
				else
				{
					$indexp="quality".($allpages-$i-1).".html";
				}
				if($indexp="quality.html")
				{
					$propage6.="<div class=\"propage\">&nbsp;</div>";
				}
				else
				{
			 		$propage6.="<div class=\"propage\"><a href=\"".$indexp."\">".($allpages-$i)."</a></div>";
			}
		}
			//页码计算
			
			for ($i=0; $i< $allpages; $i++)
			{ 
			if ($i == 0)
			{ 
			$indexpath = "quality.html";
		  } 
		  else 
		  { 
			$indexpath = "quality".$i.".html";
		  }
		 $start = $i * $onepage;
		 //查询产品
		 
		 $news_sql.=" limit ".$start.",".$onepage." ";
			 $news_query=$opendb->query($news_sql);
	
			 while($news_rows=mysqli_fetch_assoc($news_query))
				{
					$list5.="
									<div style=\"border-bottom:1px solid #ccc; width:98%;\">
										<div style=\"float:left;padding-right:10px;\">
											<a href=\"".$WorkShopFolders."/".$BigFoldersProducts."/".$news_rows['Pic']."\" target=\"_ablank\">
												<img src=\"".$WorkShopFolders."/".$SmallFoldersProducts."/".$news_rows['Pic']."\" border=\"0\">
											</a>
										</div>
										<div style=\"float:left;\">
											".$news_rows['Text']."
										</div>
									</div>
									";
				}
				$index_path="../".$templates_var."/quality.html";	//模板地址
				$ls_title=$config_row['companyName'];		//title
				$ls_keywords=$config_row['siteKeywords'];//Keywords
				$ls_description=$config_row['siteDescription'];//Description
				$ls_cate=$cate;																						//左侧产品类别
				$ls_menu=$menu;																								//主菜单
				$ls_list=$list5 ;																			//新闻news 列表
				$ls_propage=$propage6;																					//新闻分页页码
				$ls_foot=$foot;																								//底部信息
				
				$fp	   = fopen ($index_path,"r");
			  $content  = fread ($fp,filesize ($index_path));
			  $content  = str_replace ("{ls_title}",$ls_title,$content);
			  $content  = str_replace ("{ls_keywords}",$ls_keywords,$content);
				$content  = str_replace ("{ls_description}",$ls_description,$content);
				$content  = str_replace ("{ls_menu}",$ls_menu,$content);
				$content  = str_replace ("{ls_cate}",$ls_cate,$content);
				$content	= str_replace ("{ls_propage}",$ls_propage,$content);
				$content	= str_replace ("{ls_list}",$ls_list,$content);
				$content  = str_replace ("{ls_foot}",$ls_foot,$content);
				//echo $content;
				$filename="../".$indexp;
			
				if (is_file ($filename))
				{ 
			@unlink ($filename); //若文件已存在，则删除
		  }
	
		  $handle   = fopen ($filename,"w"); //打开文件指针，
			  /*
			　检查文件是否被创建且可写
			  */
			  if (!is_writable ($filename))
			  	{ 
						 echo "<script>alert('文件：".$filename."不可写，请检查其属性后重试！');history.go(-1);</script>";
				  }
			  if (!fwrite ($handle,$content))
			  	{  //将信息写入文件
				  	echo "<script>alert('生成文件".$filename."失败！');history.go(-1);</script>";
				  } 
					  fclose ($handle); //关闭指针
					 	  //die ("创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\">返回</a>");
				}
				fclose ($fp);
	  		
	  		//die ("共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>");
			$ms10="创建质量控制成功！";
		echo "<li>".$ms10."</li>";
		//break;
		
		//case "rd": //生成研发(R&D)
			$ms11="正在生成研发(R&D)...";
		$news_sql="select * from ls_rd where enable=1 order by Num desc ";
	  $result=$opendb->query($news_sql);
		$mynum = mysqli_num_rows($result);//总产品数
		// 每页数量
		$onepage = $PageNum; 
		//共有页数
		$allpages = ceil($mynum/$onepage);
		
		//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			for ($i=0; $i< $allpages; $i++)
			{ 
				if(($allpages-$i-1)==0)
				{
					$indexp="rd.html";
				}
				else
				{
					$indexp="rd".($allpages-$i-1).".html";
				}
				if($indexp="rd.html")
				{
					$propage7.="<div class=\"propage\">&nbsp;</div>";
				}
				else
				{
			 		$propage7.="<div class=\"propage\"><a href=\"".$indexp."\">".($allpages-$i)."</a></div>";
			}
		}
			//页码计算
			
			for ($i=0; $i< $allpages; $i++)
			{ 
			if ($i == 0)
			{ 
			$indexpath = "rd.html";
		  } 
		  else 
		  { 
			$indexpath = "rd".$i.".html";
		  }
		 $start = $i * $onepage;
		 //查询产品
		 
		 $news_sql.=" limit ".$start.",".$onepage." ";
			 $news_query=$opendb->query($news_sql);
	
			 while($news_rows=mysqli_fetch_assoc($news_query))
				{
					$list4.="
									<div style=\"border-bottom:1px solid #ccc; width:98%;\">
										<div style=\"float:left;padding-right:10px;\">
											<a href=\"".$WorkShopFolders."/".$BigFoldersProducts."/".$news_rows['Pic']."\" target=\"_ablank\">
												<img src=\"".$WorkShopFolders."/".$SmallFoldersProducts."/".$news_rows['Pic']."\" border=\"0\">
											</a>
										</div>
										<div style=\"float:left;\">
											".$news_rows['Text']."
										</div>
									</div>
									";
				}
				$index_path="../".$templates_var."/rd.html";		//模板地址
				$ls_title=$config_row['companyName'];		//title
				$ls_keywords=$config_row['siteKeywords'];	//Keywords
				$ls_description=$config_row['siteDescription'];//Description
				$ls_cate=$cate;																								//左侧产品类别
				$ls_menu=$menu;																								//主菜单
				$ls_list=$list4 ;																			//新闻news 列表
				$ls_propage=$propage7;																					//新闻分页页码
				$ls_foot=$foot;																								//底部信息
				
				$fp	   = fopen ($index_path,"r");
			  $content  = fread ($fp,filesize ($index_path));
			  $content  = str_replace ("{ls_title}",$ls_title,$content);
			  $content  = str_replace ("{ls_keywords}",$ls_keywords,$content);
				$content  = str_replace ("{ls_description}",$ls_description,$content);
				$content  = str_replace ("{ls_menu}",$ls_menu,$content);
				$content  = str_replace ("{ls_cate}",$ls_cate,$content);
				$content	= str_replace ("{ls_propage}",$ls_propage,$content);
				$content	= str_replace ("{ls_list}",$ls_list,$content);
				$content  = str_replace ("{ls_foot}",$ls_foot,$content);
				//echo $content;
				$filename="../".$indexp;
			
				if (is_file ($filename))
				{ 
			@unlink ($filename); //若文件已存在，则删除
		  }
	
		  $handle   = fopen ($filename,"w"); //打开文件指针，
			  /*
			　检查文件是否被创建且可写
			  */
			  if (!is_writable ($filename))
			  	{ 
						 echo "<script>alert('文件：".$filename."不可写，请检查其属性后重试！');history.go(-1);</script>";
				  }
			  if (!fwrite ($handle,$content))
			  	{  //将信息写入文件
				  	echo "<script>alert('生成文件".$filename."失败！');history.go(-1);</script>";
				  } 
					  fclose ($handle); //关闭指针
					 	  //die ("创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\">返回</a>");
				}
				fclose ($fp);
	  		
	  		//die ("共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>");
		$ms11="创建研发成功！";
		echo "<li>".$ms11."</li>";
		//break;
		
	//case "certificate": //生成证书(Certificate)
			$ms12="正在生成证书(Certificate)...";
		$news_sql="select * from ls_certificate where enable=1 order by Num desc ";
	  $result=$opendb->query($news_sql);
		$mynum = mysqli_num_rows($result);//总产品数
		// 每页数量
		$onepage = $PageNum; 
		//共有页数
		$allpages = ceil($mynum/$onepage);
		
		//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			for ($i=0; $i< $allpages; $i++)
			{ 
				if(($allpages-$i-1)==0)
				{
					$indexp="certificate.html";
				}
				else
				{
					$indexp="certificate".($allpages-$i-1).".html";
				}
				if($indexp="certificate.html")
				{
					$propage8.="<div class=\"propage\">&nbsp;</div>";
				}
				else
				{
			 		$propage8.="<div class=\"propage\"><a href=\"".$indexp."\">".($allpages-$i)."</a></div>";
			}
		}
			//页码计算
			
			for ($i=0; $i< $allpages; $i++)
			{ 
			if ($i == 0)
			{ 
			$indexpath = "certificate.html";
		  } 
		  else 
		  { 
			$indexpath = "certificate".$i.".html";
		  }
		 $start = $i * $onepage;
		 //查询产品
		 
		 $news_sql.=" limit ".$start.",".$onepage." ";
			 $news_query=$opendb->query($news_sql);
	
			 while($news_rows=mysqli_fetch_assoc($news_query))
				{
					$list3.="
									<div style=\"border-bottom:1px solid #ccc; width:98%;\">
										<div style=\"float:left;padding-right:10px;\">
											<a href=\"".$WorkShopFolders."/".$BigFoldersProducts."/".$news_rows['Pic']."\" target=\"_ablank\">
												<img src=\"".$WorkShopFolders."/".$SmallFoldersProducts."/".$news_rows['Pic']."\" border=\"0\">
											</a>
										</div>
										<div style=\"float:left;\">
											".$news_rows['Text']."
										</div>
									</div>
									";
				}
				$index_path="../".$templates_var."/certificate.html";//模板地址
				$ls_title=$config_row['companyName'];	//title
				$ls_keywords=$config_row['siteKeywords'];	//Keywords
				$ls_description=$config_row['siteDescription'];//Description
				$ls_cate=$cate;																								//左侧产品类别
				$ls_menu=$menu;																								//主菜单
				$ls_list=$list3 ;																			//新闻news 列表
				$ls_propage=$propage8;																					//新闻分页页码
				$ls_foot=$foot;																								//底部信息
				
				$fp	   = fopen ($index_path,"r");
			  $content  = fread ($fp,filesize ($index_path));
			  $content  = str_replace ("{ls_title}",$ls_title,$content);
			  $content  = str_replace ("{ls_keywords}",$ls_keywords,$content);
				$content  = str_replace ("{ls_description}",$ls_description,$content);
				$content  = str_replace ("{ls_menu}",$ls_menu,$content);
				$content  = str_replace ("{ls_cate}",$ls_cate,$content);
				$content	= str_replace ("{ls_propage}",$ls_propage,$content);
				$content	= str_replace ("{ls_list}",$ls_list,$content);
				$content  = str_replace ("{ls_foot}",$ls_foot,$content);
				//echo $content;
				$filename="../".$indexp;
			
				if (is_file ($filename))
				{ 
			@unlink ($filename); //若文件已存在，则删除
		  }
	
		  $handle   = fopen ($filename,"w"); //打开文件指针，
			  /*
			　检查文件是否被创建且可写
			  */
			  if (!is_writable ($filename))
			  	{ 
						 echo "<script>alert('文件：".$filename."不可写，请检查其属性后重试！');history.go(-1);</script>";
				  }
			  if (!fwrite ($handle,$content))
			  	{  //将信息写入文件
				  	echo "<script>alert('生成文件".$filename."失败！');history.go(-1);</script>";
				  } 
					  fclose ($handle); //关闭指针
					 	  //die ("创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\">返回</a>");
				}
				fclose ($fp);
	  		
	  		//die ("共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>");
		$ms12="创建证书成功！";
		echo "<li>".$ms12."</li>";
		//break;
		
	//case "packing": //生成包装(Packing)
			$ms13="正在生成包装(Packing)...";
		$news_sql="select * from ls_packing where enable=1 order by Num desc ";
	  $result=$opendb->query($news_sql);
		$mynum = mysqli_num_rows($result);//总产品数
		// 每页数量
		$onepage = $PageNum; 
		//共有页数
		$allpages = ceil($mynum/$onepage);
		
		//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			for ($i=0; $i< $allpages; $i++)
			{ 
				if(($allpages-$i-1)==0)
				{
					$indexp="packing.html";
				}
				else
				{
					$indexp="packing".($allpages-$i-1).".html";
				}
				if($indexp="packing.html")
				{
					$propage9.="<div class=\"propage\">&nbsp;</div>";
				}
				else
				{
			 		$propage9.="<div class=\"propage\"><a href=\"".$indexp."\">".($allpages-$i)."</a></div>";
			}
		}
			//页码计算
			
			for ($i=0; $i< $allpages; $i++)
			{ 
			if ($i == 0)
			{ 
			$indexpath = "packing.html";
		  } 
		  else 
		  { 
			$indexpath = "packing".$i.".html";
		  }
		 $start = $i * $onepage;
		 //查询产品

		 $news_sql.=" limit ".$start.",".$onepage." ";
			 $news_query=$opendb->query($news_sql);
	
			 while($news_rows=mysqli_fetch_assoc($news_query))
				{
					$list2.="
									<div style=\"border-bottom:1px solid #ccc; width:98%;\">
										<div style=\"float:left;padding-right:10px;\">
											<a href=\"".$WorkShopFolders."/".$BigFoldersProducts."/".$news_rows['Pic']."\" target=\"_ablank\">
												<img src=\"".$WorkShopFolders."/".$SmallFoldersProducts."/".$news_rows['Pic']."\" border=\"0\">
											</a>
										</div>
										<div style=\"float:left;\">
											".$news_rows['Text']."
										</div>
									</div>
									";
				}
				$index_path="../".$templates_var."/packing.html";	//模板地址
				$ls_title=$config_row['companyName'];		//title
				$ls_keywords=$config_row['siteKeywords'];	//Keywords
				$ls_description=$config_row['siteDescription'];//Description
				$ls_cate=$cate;																								//左侧产品类别
				$ls_menu=$menu;																								//主菜单
				$ls_list=$list2 ;																			//新闻news 列表
				$ls_propage=$propage9;																					//新闻分页页码
				$ls_foot=$foot;																								//底部信息
				
				$fp	   = fopen ($index_path,"r");
			  $content  = fread ($fp,filesize ($index_path));
			  $content  = str_replace ("{ls_title}",$ls_title,$content);
			  $content  = str_replace ("{ls_keywords}",$ls_keywords,$content);
				$content  = str_replace ("{ls_description}",$ls_description,$content);
				$content  = str_replace ("{ls_menu}",$ls_menu,$content);
				$content  = str_replace ("{ls_cate}",$ls_cate,$content);
				$content	= str_replace ("{ls_propage}",$ls_propage,$content);
				$content	= str_replace ("{ls_list}",$ls_list,$content);
				$content  = str_replace ("{ls_foot}",$ls_foot,$content);
				//echo $content;
				$filename="../".$indexp;
			
				if (is_file ($filename))
				{ 
			@unlink ($filename); //若文件已存在，则删除
		  }
	
		  $handle   = fopen ($filename,"w"); //打开文件指针，
			  /*
			　检查文件是否被创建且可写
			  */
			  if (!is_writable ($filename))
			  	{ 
						 echo "<script>alert('文件：".$filename."不可写，请检查其属性后重试！');history.go(-1);</script>";
				  }
			  if (!fwrite ($handle,$content))
			  	{  //将信息写入文件
				  	echo "<script>alert('生成文件".$filename."失败！');history.go(-1);</script>";
				  } 
					  fclose ($handle); //关闭指针
					 	  //die ("创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\">返回</a>");
				}
				fclose ($fp);
	  		
	  		//die ("共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>");
		$ms13="创建包装成功！";
	echo "<li>".$ms13."</li>";
	//	break;
		
		
	//	case "brand": //生成品牌(Brand)
			$ms14="正在生成包装(Packing)...";
		$news_sql="select * from ls_brand where enable=1 order by Num desc ";
	  $result=$opendb->query($news_sql);
		$mynum = mysqli_num_rows($result);//总产品数
		// 每页数量
		$onepage = $PageNum; 
		//共有页数
		$allpages = ceil($mynum/$onepage);
		
		//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			for ($i=0; $i< $allpages; $i++)
			{ 
				if(($allpages-$i-1)==0)
				{
					$indexp="brand.html";
				}
				else
				{
					$indexp="brand".($allpages-$i-1).".html";
				}
				if($indexp="brand.html")
				{
					$propage10.="<div class=\"propage\">&nbsp;</div>";
				}
				else
				{
			 		$propage10.="<div class=\"propage\"><a href=\"".$indexp."\">".($allpages-$i)."</a></div>";
			}
		}
			//页码计算
			
			for ($i=0; $i< $allpages; $i++)
			{ 
			if ($i == 0)
			{ 
			$indexpath = "brand.html";
		  } 
		  else 
		  { 
			$indexpath = "brand".$i.".html";
		  }
		 $start = $i * $onepage;
		 //查询产品
		 
		 $news_sql.=" limit ".$start.",".$onepage." ";
			 $news_query=$opendb->query($news_sql);
	
			 while($news_rows=mysqli_fetch_assoc($news_query))
				{
					$list1.="
									<div style=\"border-bottom:1px solid #ccc; width:98%;\">
										<div style=\"float:left;padding-right:10px;\">
											<a href=\"".$WorkShopFolders."/".$BigFoldersProducts."/".$news_rows['Pic']."\" target=\"_ablank\">
												<img src=\"".$WorkShopFolders."/".$SmallFoldersProducts."/".$news_rows['Pic']."\" border=\"0\">
											</a>
										</div>
										<div style=\"float:left;\">
											".$news_rows['Text']."
										</div>
									</div>
									";
				}
				$index_path="../".$templates_var."/brand.html";//模板地址
				$ls_title=$config_row['companyName'];		//title
				$ls_keywords=$config_row['siteKeywords'];	//Keywords
				$ls_description=$config_row['siteDescription'];//Description
				$ls_cate=$cate;																								//左侧产品类别
				$ls_menu=$menu;																								//主菜单
				$ls_list=$list1 ;																			//新闻news 列表
				$ls_propage=$propage10;																					//新闻分页页码
				$ls_foot=$foot;																								//底部信息
				
				$fp	   = fopen ($index_path,"r");
				$content  = fread ($fp,filesize ($index_path));
				$content  = str_replace ("{ls_title}",$ls_title,$content);
				$content  = str_replace ("{ls_keywords}",$ls_keywords,$content);
				$content  = str_replace ("{ls_description}",$ls_description,$content);
				$content  = str_replace ("{ls_menu}",$ls_menu,$content);
				$content  = str_replace ("{ls_cate}",$ls_cate,$content);
				$content	= str_replace ("{ls_propage}",$ls_propage,$content);
				$content	= str_replace ("{ls_list}",$ls_list,$content);
				$content  = str_replace ("{ls_foot}",$ls_foot,$content);
				//echo $content;
				$filename="../".$indexp;
			
				if (is_file ($filename))
				{ 
			@unlink ($filename); //若文件已存在，则删除
		  }
	
		  $handle   = fopen ($filename,"w"); //打开文件指针，
			  /*
			　检查文件是否被创建且可写
			  */
			  if (!is_writable ($filename))
			  	{ 
						 echo "<script>alert('文件：".$filename."不可写，请检查其属性后重试！');history.go(-1);</script>";
				  }
			  if (!fwrite ($handle,$content))
			  	{  //将信息写入文件
				  	echo "<script>alert('生成文件".$filename."失败！');history.go(-1);</script>";
				  } 
					  fclose ($handle); //关闭指针
					 	  //die ("创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\">返回</a>");
				}
				fclose ($fp);
	  		
	  		//die ("共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>");
				$ms14="创建品牌成功！";
		echo "<li>".$ms14."</li>";
		
		//break;
		
		
		
//}
?>  

						</td>
						</tr>
					</table>
					<br>
				</td>
			</tr>
	</table>
	</body>
</html>