<?php
// $ls="all" 生成全部，不包含产品页； $ls!="all_products" 生成全部，包含产品页；
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
?>
<!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><a href="" onclick="history.go(0);">模板管理</a></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
	require_once('inc/conn.php');
	require_once('inc/constant.php');
	require_once('inc/public.php'); //main menu & left menu
	require_once('inc/ls_syscode.php');
	require_once('inc/ls_m_syscode.php');
	
	$ls=$_GET['ls'];
	$cateid=$_GET['cateid'];
	$cateFolders=$_GET['cateFolders'];
	$midcateid=$_GET['midcateid'];
	$midcateFolders=$_GET['midcateFolders'];
	$subcateid=$_GET['subcateid'];
	$subcateFolders=$_GET['subcateFolders'];
	$menuListscateid=$_GET['menuListscateid'];	//global ver in ls_syscode
	//主菜单 start
	// public.php
	//主菜单 end
	
	//左侧产品类别 Start
	// public.php	
	//左侧产品类别 End
	
	//产品页面左侧产品类别 Start
	// public.php
	//左侧产品页面产品类别 End
	
	$tem_sql="select * from ls_config order by ID";	
	$tem_query=$opendb->query($tem_sql);
	$config_row=mysql_fetch_array($tem_query);
	//print_r($row);exit;
	$templates_var = $config_row['templates'];
	
	$mobi_tem_sql="select * from ls_mobiconfig order by ID";	
	$mobi_tem_query=$opendb->query($mobi_tem_sql);
	$mobi_row=mysql_fetch_array($mobi_tem_query);
	$mobi_templates_var = $mobi_templates;
	
	//首页常见问题列表 Start
	$sort='';
	if($newsSort=="ID") {
		$sort = "ID";
	}else if($newsSort=="Num"){
		$sort = "Num";
	}else{
		$sort = "ID";
	}
	$faq_sql="select * from ls_news where cate = 'faq'  order by $sort desc limit 0,".$newsNum."";	
	$faq_query=$opendb->query($faq_sql);
	//equire_once('inc/char_set.php');

	$i=1;
	while($faq_rows=mysql_fetch_assoc($faq_query)){
		$faq.="<li><a href=\"".$faqshowFolders."/faq".$faq_rows['ID'].".html\">".$faq_rows['faqTitle']."  (".$faq_rows['faqDate'].")</a>";
		$faq.="</li>";
		$i++;
	}
	//首页常见问题列表 End
	
//类产品展示 Start, selectPic 或者默认 后台每类选择图片 文字水命并排序
	
if($ls_classproType=="selectPic" || $ls_classproType=="")
{

	$products_sql="select * from ls_products where branchID=0 and  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 subcateName is null and subcateFolders is null and subcateBrief is null and subcateID is null and AdditionalAttributesClassPro&1 and enable=1";
	$products_sql.=" order by NoClassPro asc";
	$products_query=$opendb->query($products_sql);
	$classpro="";
	while($products_rows=mysql_fetch_assoc($products_query)){
					
		if(hassameclass($products_rows['productID'])){
			continue;
		}
		
		$p_id = $products_rows['productID'];
		$sql2 = "select * from ls_products where ID = ".$p_id." ";
		$products_query2=$opendb->query($sql2);
		
		$catename_query = mysql_fetch_assoc($products_query2);
		if(!$catename_query['subcateName']){
			if(!$catename_query['midcateName']){
				//只有大类
				$class_name = $catename_query['cateName'];
			}else{
				//有大类、有中类
				//获得关于中类的记录
				$search_catename2 = "SELECT * FROM ls_products WHERE ID={$catename_query[midcateID]}";
				$catename_query2 = mysql_fetch_assoc($opendb->query($search_catename2));
				
				$class_name = $catename_query['midcateName'];
			}
		}else{
			//有大类、有中类、有小类
			//获得关于中类的记录
			$search_catename2 = "SELECT * FROM ls_products WHERE ID={$catename_query[subcateID]}";
			$catename_query2 = mysql_fetch_assoc($opendb->query($search_catename2));
			
			//获得关于大类的记录
			$search_catename3 = "SELECT * FROM ls_products WHERE ID={$catename_query2[midcateID]}";
			$catename_query3 = mysql_fetch_assoc($opendb->query($search_catename3));
			
			$class_name = $catename_query['subcateName'];
		}
		
		
		$profile=getproductfolder($products_rows['productID']);
		$prosrc=$profile."/".$SmallFoldersProducts."/".$products_rows['productPic'];
	//$prolink=$profile."/".$showproductsFolders."/".trim(str_replace(substr($products_rows['productPic'],-4),"",$products_rows['productPic'])).".html"; 原来类产品链接
		$prolink=$profile."/index.html";//类分类的链接
		$classpro.="<li><a href=\"".$prolink."\" ><img src=\"".$prosrc."\" width=\"188\" height=\"188\" border=\"0\" alt=\"".$class_name."\" title=\"".$class_name."\"></a><span>".$class_name."</span></li>";
	}		
}	
	
	//类产品展示 End
	
	//类产品展示 Start
	//默认 $ls_classproType="picIntro" 或空 是图片列表
	if($ls_classproType=="pic" )
	{
		$products_sql="select * from ls_products where branchID=0 and 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 subcateName is null and subcateFolders is null and subcateBrief is null and subcateID is null and AdditionalAttributesClassPro&1 and enable=1";
		$products_sql.=" order by NoClassPro asc";
		$products_query=$opendb->query($products_sql);
		$classpro="";
		while($products_rows=mysql_fetch_assoc($products_query)){
					
			if(hassameclass($products_rows['productID'])){
			continue;
			}
		
			$p_id = $products_rows['productID'];
			$sql2 = "select * from ls_products where ID = ".$p_id." ";
			$products_query2=$opendb->query($sql2);
			$products_rows2=mysql_fetch_assoc($products_query2);
			
			$class_name = "";
			if($products_rows2['cateBrief'] != null){
				$class_name = $products_rows2['cateName'];
			}elseif($products_rows2['midcateBrief'] != null){
				$class_name = $products_rows2['midcateName'];
			}elseif($products_rows2['subcateBrief'] != null){
				$class_name = $products_rows2['subcateName'];
			}
			
			$pro_i++;
			$profile=getproductfolder($products_rows['productID']);
			$prosrc=$profile."/".$SmallFoldersProducts."/".$products_rows['productPic'];
					//$prolink=$profile."/".$showproductsFolders."/".trim(str_replace(substr($products_rows['productPic'],-4),"",$products_rows['productPic'])).".html"; 原来类产品链接
			$prolink=$profile."/index.html";//类分类的链接
			$classpro.="<li><a href=\"".$prolink."\" ><img src=\"".$prosrc."\" width=\"188\" height=\"188\" border=\"0\" alt=\"".$class_name."\" title=\"".$class_name."\"></a><span>".$class_name."</span></li>";
		}		
	}
	
// $ls_classproType="picIntro" 是图片文字列表
if($ls_classproType=="picIntro")
	{
		$s_classpro="";
		$classpro_sql="select * from ls_products where branchID=0 and  midcateName 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 order by Num asc";
		$classpro_query=$opendb->query($classpro_sql);
		//$s_classpro="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
		$s_classpro.="<ul class=\"classpro_list\">";
		while($classpro_rows=mysql_fetch_assoc($classpro_query))
		{
		  $pro_midcate_sql="select * from ls_products where branchID=0 and 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=".$classpro_rows['ID']." order by Num asc";
		  $pro_midcate_query=$opendb->query($pro_midcate_sql);
		  $pro_midcate_num=mysql_num_rows($pro_midcate_query);
	  
		  if($pro_midcate_num==0)//大类
		  {
		//$s_classpro.="&nbsp;<img src='../Templates/images/cate.gif' border='0'> \n";
		//$s_classpro.="\n<dt>".$classpro_rows['cateName']."</dt>";
			////
			if($classpro_rows['ID']=="")continue; //没有跳过循环
			$product_class_rows=get_product_class_rows($classpro_rows['ID']);
			$product_class_piclink=getpiclink($product_class_rows['ID'],$product_class_rows['productPic']); //
			//echo $classpro_rows['ID']."--".$product_class_piclink['picsrc']; // /thumbnails/1361107436.jpg  带/
			
			if($product_class_piclink['picsrc'] == null){
				$s_classpro.="<li class=\"class_dt\"><a href=\"../".$classpro_rows['cateFolders']."/index.html\"><img src='ls_admin/images/NoPictures_en.jpg' width='".$ls_classproPicW."' alt='".$classpro_rows['cateName']."' title='".$classpro_rows['cateName']."'  border='0'></a> <a id='classpro_list_a2' href=\"../".$classpro_rows['cateFolders']."/index.html\"><strong>".$classpro_rows['cateName']."</strong></a></li> \r\n";	
			}else{
				$s_classpro.="<li class=\"class_dt\"><a href=\"../".$classpro_rows['cateFolders']."/index.html\"><img src='../".$classpro_rows['cateFolders'].$product_class_piclink['picsrc']."' width='".$ls_classproPicW."' alt='".$classpro_rows['cateName']."' title='".$classpro_rows['cateName']."'  border='0'></a> <a id='classpro_list_a2' href=\"../".$classpro_rows['cateFolders']."/index.html\"><strong>".$classpro_rows['cateName']."</strong></a></li> \r\n";	
			}

			// $s_classpro.="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
		  } 
		  else//大类中类
		  {
			//$s_classpro.="&nbsp;<img src='../Templates/".$templates_var."/images/cate.gif' border='0'> \n";  //大类引导图
			$detailsfile="../".$classpro_rows['cateFolders']."/indexdetails.html";
			if(file_exists($detailsfile))
			{$s_classpro.=" <dt><a href='".$detailsfile."'>".$classpro_rows['cateName']."</a></dt>\r\n";}
			else
			{
				if($classpro_rows['ID']=="")continue; //没有跳过循环

				$product_class_rows=get_product_class_rows($classpro_rows['ID']);
				$product_class_piclink=getpiclink($product_class_rows['ID'],$product_class_rows['productPic']);
				//echo $product_class_piclink['picsrc'];
			
				//$s_classpro.="<li id=\"classpro_list_li_title\"> <strong>".$classpro_rows['cateName']."</strong></li> \r\n";	
				//有图：
				//$s_classpro.="<li class=\"class_dt\"><img src='../".$classpro_rows['cateFolders'].$product_class_piclink['picsrc']."' width='".$ls_classproPicW."' border='0'> <strong>".$classpro_rows['cateName']."</strong></li> \r\n";	
			}

				//$s_classpro.=" <li class=\"class_dt\"><img src='../".$templates_var."/images/006.gif' width='12' border='0'> <strong>".$classpro_rows['cateName']."</strong><ul>\r\n";}
		
				//？ 不应该有$s_classpro.="\n <div class=\"cate_list\">\n";
				while($pro_midcate_rows=mysql_fetch_assoc($pro_midcate_query))
				{
					$pro_subcate_sql="select * from ls_products where branchID=0 and 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=mysql_num_rows($pro_subcate_query); 

				//$s_classpro.="<div class=\"midcate_list\">"; //中类菜单样式
	
					if($pro_subcate_num==0)//没小类
					{
						if($pro_midcate_rows['ID']=="")continue; //没有跳过循环

						$product_class_rows=get_product_class_rows($pro_midcate_rows['ID']);
						$product_class_piclink=getpiclink($product_class_rows['ID'],$product_class_rows['productPic']);
						
						if($product_class_piclink['picsrc'] == null){
							$s_classpro.="<li class=\"class_dt\"> <a href='../".$classpro_rows['cateFolders'] ."/".$pro_midcate_rows['midcateFolders']."/index.html'><img src='ls_admin/images/NoPictures_en.jpg' width='".$ls_classproPicW."' alt='".$pro_midcate_rows['midcateName']."' title='".$pro_midcate_rows['midcateName']."' border='0'></a>  <a id='classpro_list_a2' href='../".$classpro_rows['cateFolders'] ."/".$pro_midcate_rows['midcateFolders']."/index.html'><strong>".$pro_midcate_rows['midcateName']."</strong></a></li> \r\n";
						}else{
							$s_classpro.="<li class=\"class_dt\"> <a href='../".$classpro_rows['cateFolders'] ."/".$pro_midcate_rows['midcateFolders']."/index.html'><img src='../".$classpro_rows['cateFolders'] ."/".$pro_midcate_rows['midcateFolders'].$product_class_piclink['picsrc']."' width='".$ls_classproPicW."'  alt='".$pro_midcate_rows['midcateName']."' title='".$pro_midcate_rows['midcateName']."' border='0'></a>  <a id='classpro_list_a2' href='../".$classpro_rows['cateFolders'] ."/".$pro_midcate_rows['midcateFolders']."/index.html'><strong>".$pro_midcate_rows['midcateName']."</strong></a></li> \r\n";
						}

					//$s_classpro.="&nbsp;<img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n";  //中类引导图
				//	$s_classpro.="<li><img src='Templates1/images/name_prefix.gif' border='0'> <a href='../".$classpro_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/index.html'>".$pro_midcate_rows['midcateName']."</a></li>\r\n";
					}
					else//有小类
					{
					//$s_classpro.="&nbsp;<img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n"; //中类引导图
						$detailsfile="../".$classpro_rows['cateFolders']."/".$pro_midcate_rows['midcateName']."/indexdetails.html";
						if(file_exists($detailsfile))
						{$s_classpro.="<a href='".$detailsfile."'>".$pro_midcate_rows['midcateName']."</a>\r\n";}
						else
						{
							if($pro_midcate_rows['ID']=="")continue; //没有跳过循环
							$product_class_rows=get_product_class_rows($pro_midcate_rows['ID']);
							$product_class_piclink=getpiclink($product_class_rows['ID'],$product_class_rows['productPic']);
				
							//$s_classpro.="<li id=\"classpro_list_li_title\">  <strong>".$pro_midcate_rows['midcateName']."</strong></li> \r\n";			
							//有图：
							//$s_classpro.="<li class=\"class_dt\"><img src='../".$classpro_rows['cateFolders'] .$pro_midcate_rows['midcateFolders'].$product_class_piclink['picsrc']."' width='".$ls_classproPicW."' border='0'>  <strong>".$pro_midcate_rows['midcateName']."</strong></li> \r\n";			

					//$s_classpro.="\n<dd><a href='javascript:void(0)'>".$pro_midcate_rows['midcateName']."</a>\n<ul>\r\n";
					
						}
				//$s_classpro.="<div class=\"subcate_list\">";//小类菜单样式
						while($pro_subcate_rows=mysql_fetch_assoc($pro_subcate_query))		//小类生成
						 {
					
							if($pro_subcate_rows['ID']=="")continue; //没有跳过循环
							$product_class_rows=get_product_class_rows($pro_subcate_rows['ID']);
							$product_class_piclink=getpiclink($product_class_rows['ID'],$product_class_rows['productPic']);
							
							if($product_class_piclink['picsrc'] == null){
								$s_classpro.="<li class=\"class_dt\"><a href=\"../".$classpro_rows['cateFolders'] ."/".$pro_midcate_rows['midcateFolders'] ."/".$pro_subcate_rows['subcateFolders']."/index.html\" ><img src='ls_admin/images/NoPictures_en.jpg' width='".$ls_classproPicW."' border='0'></a>  <strong><a id='classpro_list_a2' href=\"../".$classpro_rows['cateFolders'] ."/".$pro_midcate_rows['midcateFolders'] ."/".$pro_subcate_rows['subcateFolders']."/index.html\" >".$pro_subcate_rows['subcateName']."</a></strong></li>  \r\n";
							}else{
								$s_classpro.="<li class=\"class_dt\"><a href=\"../".$classpro_rows['cateFolders'] ."/".$pro_midcate_rows['midcateFolders'] ."/".$pro_subcate_rows['subcateFolders']."/index.html\" ><img src='../".$classpro_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".$pro_subcate_rows['subcateFolders'].$product_class_piclink['picsrc']."' width='".$ls_classproPicW."' border='0'></a>  <strong><a id='classpro_list_a2' href=\"../".$classpro_rows['cateFolders'] ."/".$pro_midcate_rows['midcateFolders'] ."/".$pro_subcate_rows['subcateFolders']."/index.html\" >".$pro_subcate_rows['subcateName']."</a></strong></li>  \r\n";
							}

					//$s_classpro.="<li><a href=\"../".$classpro_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".$pro_subcate_rows['subcateFolders']."/index.html\" >".$pro_subcate_rows['subcateName']."</a></li>\r\n";
						 }
						$s_classpro.=" \n\r\n"; 
					} 
			}
			$s_classpro.="  \r\n";
		  }//if($pro_midcate_num==0)//dalei
	
		}
		$s_classpro.="</ul>\r\n ";
		$classpro=str_replace("../","",$s_classpro);//cate

	}

	// $ls_classproType="cateList" 产品分类展开列表
	if($ls_classproType=="cateList"  )
	{	
		$s_classpro="";
		$classpro_sql="select * from ls_products where branchID=0 and midcateName 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 order by Num asc";
		$classpro_query=$opendb->query($classpro_sql);
		//$s_classpro="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
		$s_classpro.="<ul class=\"ls_classpro\">";
		while($classpro_rows=mysql_fetch_assoc($classpro_query))
		{
		  $pro_midcate_sql="select * from ls_products where branchID=0 and 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=".$classpro_rows['ID']." order by Num asc";
		  $pro_midcate_query=$opendb->query($pro_midcate_sql);
		  $pro_midcate_num=mysql_num_rows($pro_midcate_query);
	  
		  if($pro_midcate_num==0)//大类
		  {
		//$s_classpro.="&nbsp;<img src='../Templates/images/cate.gif' border='0'> \n";
		//$s_classpro.="\n<dt>".$classpro_rows['cateName']."</dt>";
		
			$s_classpro.="<li><img src='../".$templates_var."/images/name_prefix.gif' border='0'> <a href='../".$classpro_rows['cateFolders']."/index.html'>".$classpro_rows['cateName']."</a></li><ul> \r\n";
			// $s_classpro.="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
		  } 
		  else//大类中类
		  {
			//$s_classpro.="&nbsp;<img src='../Templates/".$templates_var."/images/cate.gif' border='0'> \n";  //大类引导图
			$detailsfile="../".$classpro_rows['cateFolders']."/indexdetails.html";
			if(file_exists($detailsfile))
			{ 	$s_classpro.=" <dt><a href='".$detailsfile."'>".$classpro_rows['cateName']."</a></dt>\r\n";}
			else
			{	$s_classpro.=" <li><img src='../".$templates_var."/images/name_prefix.gif' border='0'> <a href='javascript:void(0)'>".$classpro_rows['cateName']."</a><ul>\r\n";}
		
			//？ 不应该有$s_classpro.="\n <div class=\"cate_list\">\n";
				while($pro_midcate_rows=mysql_fetch_assoc($pro_midcate_query))
				{
					$pro_subcate_sql="select * from ls_products where branchID=0 and 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=mysql_num_rows($pro_subcate_query); 

				//$s_classpro.="<div class=\"midcate_list\">"; //中类菜单样式
	
					if($pro_subcate_num==0)//没小类
					{
					//$s_classpro.="&nbsp;<img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n";  //中类引导图
						$s_classpro.="<li><a href='../".$classpro_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/index.html'>".$pro_midcate_rows['midcateName']."</a></li>\r\n";
					}
					else//有小类
					{
					//$s_classpro.="&nbsp;<img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n"; //中类引导图
						$detailsfile="../".$classpro_rows['cateFolders']."/".$pro_midcate_rows['midcateName']."/indexdetails.html";
						if(file_exists($detailsfile))
						{$s_classpro.="<a href='".$detailsfile."'>".$pro_midcate_rows['midcateName']."</a>\r\n";}
						else
						{$s_classpro.="\n<dd><a href='javascript:void(0)'>".$pro_midcate_rows['midcateName']."</a>\n<ul>\r\n";}
					//$s_classpro.="<div class=\"subcate_list\">";//小类菜单样式
						while($pro_subcate_rows=mysql_fetch_assoc($pro_subcate_query))		//小类生成
						{
							$s_classpro.="<li><a href=\"../".$classpro_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".$pro_subcate_rows['subcateFolders']."/index.html\" >".$pro_subcate_rows['subcateName']."</a></li>\r\n";
						 }
					$s_classpro.="</ul>\n</dd>\r\n"; 
					}
				}
				$s_classpro.="</ul></li>\r\n";
			  }//if($pro_midcate_num==0)//dalei
	
		}
		$s_classpro.="</ul>\r\n ";
		//echo $s_classpro;
		$classpro=str_replace("../","",$s_classpro);//cate
	}
	//类产品展示 End
	
	
	//首页产品展示 Start
	$products_sql="select * from ls_products where branchID=0 and  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 subcateName is null and subcateFolders is null and subcateBrief is null and subcateID is null and AdditionalAttributes&1 and enable=1";
	$products_sql.=" order by No asc ";
	$products_query=$opendb->query($products_sql);
	$homepro="";
	$count=0;
	while($products_rows=mysql_fetch_assoc($products_query)){
		if(hassameclass($products_rows['productID'])){
			continue;
		}
		$pro_i++;
		$count++;
		$profile=getproductfolder($products_rows['productID']);
		
		$hotprofilenamearray = explode("/", strrev($profile));
		$hotprofilename = strrev($hotprofilenamearray[0]);
		$prosrc=$profile."/".$SmallFoldersProducts."/".$products_rows['productPic'];
		$prolink=$profile."/".$showproductsFolders."/".trim(str_replace(substr($products_rows['productPic'],-4),"",$products_rows['productPic'])).".html";
		
		$homepro.="<div class=\"col-xs-3 col-5\">
			<div class=\"thumbnail pro\"> <a href=\"".$profile."/".getproductpath($products_rows['productID']).".html?menuId=".$products_rows['productID']."\" target=\"_blank\"><img src=\"".$prosrc."\" /></a>
				<div class=\"caption pro-name\"> <a href=\"".$profile."/".getproductpath($products_rows['productID']).".html?menuId=".$products_rows['productID']."\" target=\"_blank\">".$products_rows['productName']."</a> </div>
			</div>
		</div>";
		
	}
	//首页产品展示 End

	//热点产品展示 Start
	$products_sql="select * from ls_products where branchID=0 and  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 subcateName is null and subcateFolders is null and subcateBrief is null and subcateID is null and AdditionalAttributes&2 and enable=1";
	$products_sql.=" order by Num asc";
	$products_query=$opendb->query($products_sql);
	$hotpro="";
	$i_num = 0;
	while($products_rows=mysql_fetch_assoc($products_query)){
		if(hassameclass($products_rows['productID'])){
			continue;
		}
		$pro_i++;
		$i_num++;
		$profile=getproductfolder($products_rows['productID']);
		$prosrc=$profile."/".$SmallFoldersProducts."/".$products_rows['productPic'];
		$prolink=$profile."/".trim(str_replace(substr($products_rows['productPic'],-4),"",$products_rows['productPic'])).".html";
	  
		$hotpro.="<div class=\"proall\">";
		$hotpro.="<div class=\"proPic\" >";
		$hotpro.="<a href=\"".$prolink."\" target=\"_blank\"><img src=\"".$prosrc."\" border=\"0\" alt=\"".$products_rows['productName']."\" /></a>";
		$hotpro.="</div>";
		$hotpro.="<div class=\"proItem\" ><a href=\"".$prolink."\" target=\"_blank\">".$products_rows['productName']."</a></div>";
		$hotpro.="<div class=\"proItem\" ><a href=\"".$prolink."\" target=\"_blank\">".$products_rows['productItemNo']."</a></div>";
		$hotpro.="</div>";
		
	}
	//热点产品展示 End

	//主题图
	$motif_sql="select * from ls_motif where enable=1 order by Num desc ";
	$motif_query=$opendb->query($motif_sql);
	
	$s_motif_cate.="";
	while($motif_rows=mysql_fetch_assoc($motif_query)){
		if($motif_rows['motif_href'] !=''){
			$s_motif_cate.="<li data-transition=\"boxslide\" ><img src=\"../".$MotifFolders."/".$BigFoldersProducts."/".$motif_rows['motifPic']."\"  alt=\"".$motif_rows['motifText']."\">
			<div class=\"tp-caption slider-text-description sft str\"  data-x=\"20\" data-y=\"280\" data-start=\"1500\" data-easing=\"easeOutBack\" data-end=\"5000\" data-endspeed=\"500\"><a href=\"".$motif_rows['motif_href']."\" class=\"button btn-flat\">More Info</a></div>   
			</li>";
		}else{
			$s_motif_cate.="<li data-transition=\"boxslide\" ><a href=\"javascript:void(0)\" ><img src=\"../".$MotifFolders."/".$BigFoldersProducts."/".$motif_rows['motifPic']."\"  alt=\"".$motif_rows['motifText']."\"></a></li>";
		}
	}
	$s_motif_cate.=" ";
	
	$s_m_cate=str_replace("../","",$s_motif_cate);//cate
	$s_m2_cate=str_replace("../","../",$s_motif_cate);//pro2_cate
	$s_m3_cate=str_replace("../","../../",$s_motif_cate);//pro3_cate
	$s_m4_cate=str_replace("../","../../../",$s_motif_cate);//pro4_cate
	
	//主题图 End


	//新产品展示 Start 2011-2-22 修正 img标签 结束错误
	$products_sql="select * from ls_products where branchID=0 and  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 subcateName is null and subcateFolders is null and subcateBrief is null and subcateID is null and AdditionalAttributes&4 and enable=1";
	$products_sql.=" order by Num asc ";
	$products_query=$opendb->query($products_sql);
	$newpro="";
	while($products_rows=mysql_fetch_assoc($products_query)){
		if(hassameclass($products_rows['productID'])){
			continue;
		}
		$pro_i++;
		$profile=getproductfolder($products_rows['productID']);
		$prosrc=$profile."/".$SmallFoldersProducts."/".$products_rows['productPic'];
		$prolink=$profile."/".trim(str_replace(substr($products_rows['productPic'],-4),"",$products_rows['productPic'])).".html";


		$newpro.="<div class=\"proall\">";
		$newpro.="<div class=\"proPic\" >";
		$newpro.="<a href=\"".$prolink."\" target=\"_blank\"><img src=\"".$prosrc."\" border=\"0\" alt=\"".$products_rows['productName']."\" /></a>";
		$newpro.="</div>";
		$newpro.="<div class=\"proItem\" ><a href=\"".$prolink."\" target=\"_blank\">".$products_rows['productName']."</a></div>";
		$newpro.="<div class=\"proItem\" ><a href=\"".$prolink."\" target=\"_blank\">".$products_rows['productItemNo']."</a></div>";
		$newpro.="</div>";
		
	}																		
	//新产品展示 End
	
	$inf_sql="select * from ls_information where inMenu = 'aboutus' order by ID";	
	$inf_query=$opendb->query($inf_sql);
	$inf_row=mysql_fetch_array($inf_query);
	
	$lenght_sql="select * from ls_functioncode where codeID = 'aboutLenght' order by ID";	
	$lenght_query=$opendb->query($lenght_sql);
	$lenght_row=mysql_fetch_array($lenght_query);
	
	$about=mb_substr(str_replace("../", "", $inf_row['homeAbout']),0,$lenght_row['code'],'utf-8').((strlen($inf_row['content'])>$lenght_row['code'])?" <a href=\"aboutus.html\">(More...)</a>":"");
	$allabout=str_replace("../", "", $inf_row['content']);
	$allabout_m = str_replace("href=\"../", "href=\"", $inf_row['content']);
	
	$file_welcome="../".$templates_var."/welcome.html";	//模板地址
	$ls_title=$config_rows['companyName'];					//title
	$ls_keywords=$config_rows['siteKeywords'];				//Keywords
	$ls_description=$config_rows['siteDescription'];		//Description
	
	if(file_exists($file_welcome)){
		$fp = fopen($file_welcome,"r");
		$procontent  = fread($fp,filesize($file_welcome));
		$procontent  = str_replace("../","/",$procontent);
		$procontent  = str_replace("{ls_title}",$ls_title,$procontent);
		$procontent  = str_replace("{ls_keywords}",$ls_keywords,$procontent);
		$procontent  = str_replace("{ls_description}",$ls_description,$procontent);
		$procontent  = str_replace("{ls_s_cate}",$s_cate,$procontent);
		$procontent  = str_replace("{ls_site_cate}",$site_cate1,$procontent);

		$profilename="../welcome.html";
		if (is_file ($profilename)){ 
			@unlink ($profilename); //若文件已存在，则删除
		}
		$handle   = fopen($profilename,"w"); //打开文件指针，
		/*
		　检查文件是否被创建且可写
		*/
		if (!is_writable ($profilename)){ 
			echo "文件：".$profilename."不可写，请检查其属性后重试！";
		}
		if (!fwrite ($handle,$procontent)){  //将信息写入文件
			echo "".$profilename."失败！";
		}else{
			echo "生成 <a href='".$profilename."'>".$profilename."</a><br>";
		}
		fclose ($handle); //关闭指针
		//die ("创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\"><u>返回</u></a>");
		fclose ($fp);
	}
	
	switch($ls){
		case "all_products": //生成全部页面，包括产品页，否则break	
		case "products":  //生成产品页 products
			
			$pro_pic_sql="SELECT * FROM `ls_products` WHERE `cateName` IS NOT NULL and catePic !='' order by Num";
			$pro_pic_query=$opendb->query($pro_pic_sql);
			
			$ls_pro = "<div class=\"row pro_list\">";
			while($pro_pic_rows=mysql_fetch_assoc($pro_pic_query)){
				$ls_pro .= "<div class=\"col-lg-4 col-md-4 col-sm-6 col-xs-12\"><div class=\"thumbnail\"><div class=\"img-pic\"><a href=\"".$pro_pic_rows['cateFolders']."/".$pro_pic_rows['cateFolders'].".html\"><img src=\"".$pro_pic_rows['cateFolders']."/".$pro_pic_rows['catePic']."\" name=\"imgs\" alt=\"".$pro_pic_rows['midcateName']."\" /></a></div><div class=\"caption pro-name\"><a href=\"".$pro_pic_rows['cateFolders']."/".$pro_pic_rows['cateFolders'].".html\">".$pro_pic_rows['cateName']."</a></div></div></div>";
			}
			$ls_pro .= "</div>";

			$index_newspath="../".$templates_var."/prolist.html";		//模板地址
			if(file_exists($index_newspath)){
				$ls_title = $config_row['companyName'];				//title
				$ls_keywords=$config_row['siteKeywords'];			//Keywords
				$ls_description=$config_row['siteDescription'];	//Description
				$ls_cate=$pro_cate;
				$ls_s_cate=$s_pro_cate;								//左侧产品类别;
				$ls_s_news = $ls_h1_news;
				$ls_p_cate=$s_p_cate;								//左侧产品类别;
				$ls_f_cate=get_pro_cate(1);
				$ls_motif=$s_m2_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_s_cate}",$ls_s_cate,$newscontent);
				$newscontent = str_replace("{ls_pro}",$ls_pro,$newscontent);
				$newscontent = str_replace("{ls_p_cate}",$ls_p_cate,$newscontent);
				$newscontent = str_replace("{ls_f_cate}",$ls_f_cate,$newscontent);
				$newscontent = str_replace("{ls_motif}",$ls_motif,$newscontent);
				$newscontent = str_replace("{ls_propage}",$ls_propage,$newscontent);
				$ls_facebook_twitter = $facebook_twitter;
				$newscontent = str_replace("{ls_weibo}",$ls_facebook_twitter,$newscontent);
				$ls_facebook_twitter_share = $facebook_twitter_share;
				$newscontent = str_replace("{ls_weiboshare}",$ls_facebook_twitter_share,$newscontent);
				
				$ls_indicatebar = "<li><a href=\"../index.html\">Home</a></li>
								   <li style='text-transform : capitalize;'>Products</li>";
				$newscontent = str_replace("{ls_indicatebar}",$ls_indicatebar,$newscontent);
				$newscontent = str_replace("{ls_news}",$ls_s_news,$newscontent);
				$newscontent = str_replace("{ls_newstime}",$ls_newstime,$newscontent);
				$newscontent = str_replace("{ls_newid}",$ls_newid,$newscontent);
				$newscontent = str_replace("{ls_click_n}",$ls_click_n,$newscontent);
				$newscontent = str_replace("{ls_newstitle}",$ls_newstitle,$newscontent);
				$newscontent = str_replace("{ls_newstext}",$ls_newstext,$newscontent);
				$newscontent = str_replace("{ls_newsdongtai}",$ls_newsdongtai2,$newscontent);		//子目录下新闻
	//new
				$newscontent = str_replace("{ls_newsgonggao}",$ls_newsgonggao2,$newscontent);
				$newscontent = str_replace("{ls_newsall}",$ls_newsall2,$newscontent);
				$newscontent = str_replace("{ls_newstieshi}",$ls_newstieshi2,$newscontent);
				$newscontent = str_replace("{ls_site_cate}",$s_site_cate,$newscontent);
	
				$newscontent = str_replace("{ls_url}",$ls_url,$newscontent);
				$newscontent = str_replace("{ls_foot}",$ls_foot,$newscontent);
				$newscontent = str_replace("{ls_addprolink}",$ls_addprolink,$newscontent);	//指向主菜单中的Products链接
				$newscontent = str_replace("{ls_addnewprolink}",$ls_addnewprolink,$newscontent);	//指向主菜单中的NewProducts链接
				$newscontent = str_replace("../","",$newscontent);
				$filename="../prolist.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 "'生成文件".$filename."失败！";
				 } 
				fclose ($handle); //关闭指针
					echo "创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\"><u>返回</u></a><br/><br/>";
				fclose ($fp);
			}else{
				echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";
			}
			
			//echo "<h1>".$ls."</h1>";
			$menuListscateidall=0;
			/*$cate_sql="select * from ls_products where midcateID is null and midcateName 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 order by Num asc";*/
			//查找大类的SQL语句
			$cate_sql = 'SELECT * FROM `ls_products` WHERE cateName IS NOT NULL';
			$cate_query=$opendb->query($cate_sql);
			while($cate_rows=mysql_fetch_assoc($cate_query)){
				if($_GET['productsall']=="ok"){
					$cateid=$cate_rows['ID'];
					$menuListscateid=0;
				}
				$products_sql_p="select * from ls_products where branchID=0 and midcateID 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 subcateName is null and subcateFolders is null and subcateBrief is null and subcateID is null ";
				//大类
				if( $cateid!="" && $midcateid=="" && $subcateid=="" ){
					//大类下有中类
					//echo "<h1>".$cateid."</h1>";
					$sqlstr1="SELECT `ID` FROM `ls_products` WHERE midcateID=".$cateid;
					$query1=$opendb->query($sqlstr1);
					$mynum1=mysql_num_rows($query1);
					if($mynum1!=0){
						//有中类
						$DetailPage=1;
						writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid);// write 所有大枝类的details
						$DetailPage=0; //reset flag
			
						$menuListscateidall++;
						if($_GET['productsall']=="ok"){$menuListscateid=$menuListscateidall;}		// if it is all products set $menuListscateid
						while($myrows1=mysql_fetch_assoc($query1)){
							$sqlstr2="select ID from ls_products where subcateID =".$myrows1['ID']." ";
							$query2=$opendb->query($sqlstr2);
							$mynum2=mysql_num_rows($query2);
							if($mynum2!=0){
								//有小类
								$midcateid=$myrows1['ID'];
								$mid_id = $midcateid;
								$DetailPage=1;
								writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid);// write 所有中枝类的details
								$DetailPage=0; //reset flag
			
								while($myrows2=mysql_fetch_assoc($query2)){
									$productID=" productID=".$myrows2['ID'];
									$products_sql=$products_sql_p." and ".$productID;
									$subcateid=$myrows2['ID'];
									$midcateid = $mid_id;
									writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid);
									$midcateid="";
									$subcateid="";
								}
							}
							else{
								//没有小类
								$productID=" productID=".$myrows1['ID'];
								$products_sql=$products_sql_p." and ".$productID;
								$midcateid=$myrows1['ID'];
								writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid);
								$midcateid="";
							}
						}
					}
					else{
						$products_sql=$products_sql_p." and productID=".$cateid;
						writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid);
					}
				}
			
				
				//中类
				if($cateid!="" && $midcateid!="" && $subcateid==""){
					//中类下有小类
					$sqlstr="select ID from ls_products where subcateID =".$midcateid." ";
					$query1=$opendb->query($sqlstr);
					$mynum=mysql_num_rows($query1);
					if($mynum!=0){
						while($myrows=mysql_fetch_assoc($query1)){
								$productID=" productID=".$myrows['ID'];
								$products_sql=$products_sql_p." and ".$productID;
								$subcateid=$myrows['ID'];
								writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid);
								$subcateid="";
						}
					}
					else{
						//中类下没有小类
						$products_sql=$products_sql_p." and productID=".$midcateid;
						writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid);
			
					}
				}
				//小类
				if($cateid!="" && $midcateid!=""&& $subcateid!=""){
					$products_sql=$products_sql_p." and productID=".$subcateid;
					writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid);
				}
				//echo 	$products_sql;
				echo "生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=products\"><u>返回</u></a><br/>
				---------------------------------------------------------------------------------------------------<br/><br/><br/>";																				
				if($_GET['productsall']=="ok")//不生成全部产品就执行一次循环退出
				{}
				else
				{break;}
			}// end of cate while
			if($ls!="all_products"){
				//生成全部页面，不包括产品页，否则break 
				break;
			}

		case "all":						//生成全部页面，不包括产品页
		case "nomenufiles":				//生成首页
			$ls_cate=$cate;				//左侧产品类别
			$ls_menu=$menu;				//主菜单
			$ls_classpro=$classpro;			//类别产品
			$ls_motif=$s_m_cate;
			$ls_hotpro=$hotpro;			//功能页面热点产品
			$ls_newpro=$newpro;			//功能页面新产品
			// $ls_title, $ls_keywords, $ls_description from public
			$ls_foot=$foot;				//底部信息
			$ls_site_cate = $site_cate;
			foreach($generalCreateFiles as $createdfile){
				$index_path="../".$templates_var."/";//模板目录
				$mainpartsubject=$createdfile;
				$filename="../".$createdfile;
				$index_path=$index_path.$createdfile;
				$mainpart="";
				$ls_introduction="";
				$ls_feedbackemail="";
				$ls_propage="";
				writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,
	$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
			}
	
			echo "生成member 目录下文件--------------------<br />";
			foreach($generalCreateFilesMembers as $createdfile){			//生成member 下文件
				$subFolder=true;		//设置子目录 替换../../ 为 ../
				$index_path="../".$templates_var."/";//模板目录
				$mainpartsubject="createdfile";
				$filename="../member/".$createdfile;
				$index_path=$index_path.$createdfile;
				$mainpart="";
				$ls_introduction="";
				$ls_feedbackemail="";
				$ls_propage="";
				writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_menu,$ls_foot,
	$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
			}
			$subFolder=false;
				
			echo "生成agent 目录下文件--------------------<br />";
			foreach($generalCreateFilesAgents as $createdfile ) {			//生成agent 下文件
				$subFolder=true;
				$index_path="../".$templates_var."/";//模板目录
				$mainpartsubject="createdfile";
				$filename="../agent/".$createdfile;
				$index_path=$index_path.$createdfile;
				$mainpart="";
				$ls_introduction="";
				$ls_feedbackemail="";
				$ls_propage="";
				writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_menu,$ls_foot,
	$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
			}
			$subFolder=false;
			if($ls!="all" && $ls!="all_products"){
				//生成全部页面，不包括产品页，否则break 
				break;
			}

     //生成单页
    case "singlepage":
		$sql = "select * from ls_singlepages where enable=1";
		$list = $opendb->allRows($sql);
		
		foreach($list as $v){
			$tpl = '../'.$templates_var."/".$v['static_tpl'];
			if(file_exists($tpl)){
				$arr = explode('.',$v['singlepage_name']);
				if($arr[1]=='html'){
					$ls_s_cate = $s_cate;				//左侧产品类别
					$ls_menu=$menu;				//主菜单
					$ls_classpro=$classpro;			//类别产品
					$ls_motif=$s_m_cate;
					$ls_hotpro=$hotpro;			//功能页面热点产品
					$ls_newpro=$newpro;			//功能页面新产品
					$ls_p_cate=$s_p0_cate;								//左侧产品类别;
					// $ls_title, $ls_keywords, $ls_description from public
					$ls_foot=$foot;				//底部信息
					$ls_site_cate = $site_cate;
					global $ls_about,$ls_news,$ls_homepro,$ls_newpro,$ls_classpro,$ls_hotpro,$ls_designby,$ls_news,$ls_link,$ls_s_cate,$ls_newsdongtai,$ls_newsgonggao,$ls_newstieshi,$ls_revo,$ls_allcatepics,$ls_site_cate,$facebook_twitter,$facebook_twitter_share;
					
					$tem_sql="select * from ls_config order by ID";	
					$tem_query=$opendb->query($tem_sql);
					$row=mysql_fetch_array($tem_query);
				
					$facebook_twitter = str_replace("YOUR-FACEBOOK",$row['facebook'],$facebook_twitter);
					$facebook_twitter = str_replace("YOUR-TWITTER",$row['twitter'],$facebook_twitter);
					$facebook_twitter = str_replace("YOUR-LINKEDIN",$row['linkedin'],$facebook_twitter);
					$facebook_twitter = str_replace("YOUR-GOOGLE",$row['google'],$facebook_twitter);
					$facebook_twitter = str_replace("YOUR-PINTEREST",$row['pinterest'],$facebook_twitter);
					$facebook_twitter = str_replace("YOUR-YOUTUBE",$row['youtube'],$facebook_twitter);
					$facebook_twitter = str_replace("../","",$facebook_twitter);
					
					$handle = fopen($tpl,'r');
					$content = fread($handle,filesize ($tpl));
					$content = str_replace("{ls_title}",$ls_title,$content);
					$content = str_replace("../","",$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_s_cate}",$ls_s_cate,$content);
					$content = str_replace("{ls_motif}",$ls_motif,$content);
					$content = str_replace("{ls_m_news}",$ls_m_news,$content);
					$content = str_replace("{ls_link}",$ls_link,$content);
					$content = str_replace("{ls_about}",$ls_about,$content);
					
					$content = str_replace("{ls_site_cate}",$ls_site_cate,$content);
					$ls_facebook_twitter = $facebook_twitter;
					$content = str_replace("{ls_weibo}",$ls_facebook_twitter,$content);
					$content = str_replace("{ls_weiboshare}",$facebook_twitter_share,$content);
					
					$content = str_replace("{ls_p_cate}",$ls_p_cate,$content);
					
					$content = str_replace("{ls_news}",$ls_news,$content);
					$content = str_replace("{ls_newsdongtai}",$ls_newsdongtai,$content);
					$content = str_replace("{ls_newsgonggao}",$ls_newsgonggao,$content);
					$content = str_replace("{ls_newstieshi}",$ls_newstieshi,$content);
					$content = str_replace("{ls_homepro}",$ls_homepro,$content);
					$content = str_replace("{ls_designby}",$ls_designby,$content);
					$content = str_replace("{ls_cate}",$ls_cate,$content);
					$content = str_replace("{ls_foot}",$ls_foot,$content);
					$content = str_replace("{ls_addprolink}",$ls_addprolink,$content);	//指向主菜单中的Products链接
					$content = str_replace("{ls_addnewprolink}",$ls_addnewprolink,$content);	//指向主菜单中的NewProducts链接
					$content = str_replace("{ls_classpro}",$ls_classpro,$content); //类别产品链接
					$content = str_replace("{ls_hotpro}",$ls_hotpro,$content); //热点产品链接
					$content = str_replace("{ls_revo}",$ls_revo,$content); //主题流动图片
					$content = str_replace("{ls_search}",ls_search(),$content); //搜索框
					$content = str_replace("{ls_allcatepics}",$ls_allcatepics,$content); //搜索框
					
					$content = str_replace("{singlepage_title}",$v['pageTitle'],$content);
					$content = str_replace("{singlepage_content}",str_replace("../", "",$v['pageText']),$content);
					fclose($handle);
					
					$handle = fopen('../'.$v['singlepage_name'],'w+');
					if (!is_writable ('../'.$v['singlepage_name']))
					{ 
						echo "文件："."../".$v['singlepage_name']."不可写，请检查其属性后重试！";
					}else{
						if(fwrite($handle,$content)){
							echo "<p>生成 <a href='../".$v['singlepage_name']."'>../".$v['singlepage_name']."</a>成功</p>";	
							fclose ($handle);
						}	
					}
					
				
					
				}else{
					echo "生成的".$v['singlepage_name']."文件格式错误";	
				}
				
			}else{
				echo "<p>模版文件".$tpl."不存在，生成".$v['singlepage_name']."失败</p>";	
			}
		}
	
	
	
		if($ls!="all" && $ls!="all_products"){
				//生成全部页面，不包括产品页，否则break 
				break;
			}

	case "index":  //生成首页
		$index_path="../".$templates_var."/index.html";//首页模板地址
		$ls_cate=$cate;				//左侧产品类别
		$ls_motif=$s_m_cate;
		$ls_menu=$menu;				//主菜单
		$ls_about=$about ;			//globle 首页About us 
		$ls_news=$news;				//globle 首页News
		$ls_faq=$faq;				//globle 首页faq
		$ls_revo=$revo;
		$ls_homepro=$homepro;			//globle 首页Hot products
		// $ls_title, $ls_keywords, $ls_description from public
		$ls_allcatepics=get_allcatepics();
		$ls_foot=$foot;				//底部信息
		$mainpartsubject="index";
		$filename="../index.html";
		writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,
$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
	
		if($ls_news!=""){	
			$news_cate_sql2="select * from `ls_functioncates` where functionName='新闻分类' and enable=1 order by Num asc ";

	$result_cate=$opendb->query($news_cate_sql2);
	$num_cate=mysql_num_rows($result_cate);
	 //$catenews = mysql_fetch_assoc($result_cate);
	$i_news=1;
	// 遍历所有分类 cate, 按分类生成 相关分类的news index.php，如 index_all.html, index_tieshi.html
	// 分页显示，以及全部新闻内容页 newsshow.html
	while(true)
	{
	  if($num_cate==0)
	  {
		 $news_sql2="select * from ls_news where enable=1 order by Num,newsDate desc ";
		 $suffix_str="_all";
	  }
	  else
	  {
		 $catenews = mysql_fetch_assoc($result_cate);
		 $news_sql2="select * from ls_news where enable=1 and cate='".$catenews['cateName']."' order by Num,newsDate desc ";
 		 $suffix_str=$catenews['suffStr'];

	  }
	  
	$result=$opendb->query($news_sql2);
	$mynum = mysql_num_rows($result);//总产品数
		// 每页数量
	$onepage = $PageNumNews; 
		//共有页数
	$allpages = ceil($mynum/$onepage);
		
	//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
	//页码计算  在ls_syscode里面
	$propage=getPages("news".$suffix_str.".html",$allpages);
	//页码计算

	for ($i=0; $i< $allpages; $i++){ 
		$newslist="";
		if ($i == 0){ 
	 		$indexpath = "news".$suffix_str.".html";
		}else{ 
	   		$indexpath = "news".$suffix_str.$i.".html";
		}
		$start = $i * $onepage;

		 //查询产品
		 
		$news_sql=$news_sql2." limit ".$start.",".$onepage." ";
		$news_query=$opendb->query($news_sql2);
		while($news_rows=mysql_fetch_assoc($news_query)){
			$newslist.="<div style=\"padding-left:15px; padding-top:10px;\"><img src='Templates/images/news.gif' border='0'> <a href=\"".$newsshowFolders."/news".$news_rows['ID'].".html\">".$news_rows['newsTitle']."  (".substr($news_rows['newsDate'],-5).")</a>";
			$newslist.="<div class=\"xuxian\"></div></div>";
			
			$index_newspath="../".$templates_var."/newsshow.html";											//模板地址
			if(file_exists($index_newspath)){
				$newstitle=$news_rows['newsTitle'];
				$newstext=$news_rows['newsText'];
				$ls_newstime = $news_rows['newsDate'];
				$ls_newid = $news_rows['ID'];
				$ls_click_n = $news_rows['clickNum'];
				createFolder("../".$newsshowFolders);
						
				$ls_title=$news_rows['title']." - ".$config_rows['companyName'];				//title
				$ls_keywords=$news_rows['keywords'];					//Keywords
				$ls_description=$news_rows['description'];							//Description
				$ls_cate=$pro_cate;
				$ls_s_cate=$s_cate;																						//左侧产品类别;
				$ls_motif=$s_pro_cate;
				$ls_menu=$menu_pro;																						//主菜单
				$ls_newstitle=$newstitle ;																		//新闻标题
				$ls_newstext=$newstext;
				$ls_revo=$pro_revo;
				$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_s_cate}",$ls_s_cate,$newscontent);
				$newscontent = str_replace("{ls_motif}",$ls_motif,$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_newstime}",$ls_newstime,$newscontent);
				$newscontent = str_replace("{ls_newid}",$ls_newid,$newscontent);
				$newscontent = str_replace("{ls_click_n}",$ls_click_n,$newscontent);
				
				//$newscontent = str_replace("../","{ls_url}../../",$newscontent);
				$newscontent = str_replace("{ls_newsdongtai}",$ls_newsdongtai2,$newscontent);		//子目录下新闻
	//new
				$newscontent = str_replace("{ls_newsgonggao}",$ls_newsgonggao2,$newscontent);
				$newscontent = str_replace("{ls_newsall}",$ls_newsall2,$newscontent);
				$newscontent = str_replace("{ls_newstieshi}",$ls_newstieshi2,$newscontent);
	
				$newscontent = str_replace("{ls_url}",$ls_url,$newscontent);
				$newscontent = str_replace("{ls_foot}",$ls_foot,$newscontent);	
				$newscontent = str_replace("{ls_revo}",$ls_revo,$newscontent);	
				
				$newscontent = circleNavigationLinkNews($news_rows['ID'],'F','{ls_nextlink}',$newscontent,"ls_news",$catenews['cateName'],"news",$suffix_str2,true);
				$newscontent = circleNavigationLinkNews($news_rows['ID'],'B','{ls_previouslink}',$newscontent,"ls_news",$catenews['cateName'],"news",$suffix_str2,true);
				//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); //关闭指针
				 //echo "创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\"><u>返回</u></a><br/><br/>";
				fclose ($fp);
			}else{
				echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";
			}
		}		
  		echo "共有".$mynum."条新闻。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
	}//end for , all pages
		if($num_cate==0 || $i_news==$num_cate)		//没有新闻分类 循环一遍退出， 如有新闻分类 循环所有分类
		{break;}
		else
		{
			$i_news++;
		}
	
	}	
  		
	}//
		
 if($ls!="all" && $ls!="all_products")//生成全部页面，不包括产品页，否则break 
 {break;}
 	
   case "aboutus":  //生成 About us
  
		$index_path="../".$templates_var."/aboutus.html";	//模板地址
		
		$information_sql="select * from ls_information where inMenu='aboutus' ";
		$information_query=$opendb->query($information_sql);
		$information_rows=mysql_fetch_assoc($information_query);
		
		$ls_title=$information_rows['inTitle'];//title
		$ls_keywords=$information_rows['inKeywords'];	//Keywords
		$ls_description=$information_rows['inDescription'];//Description
		$ls_cate=$s_cate;			//左侧产品类别
		$ls_p_cate=$s_p1_cate;			//左侧产品类别
		$ls_motif=$s_m_cate;
		$ls_menu=$menu;		//主菜单
		$ls_allabout=$information_rows['content'];
		
		$ls_foot=$foot;		//底部信息
		
		$ls_propage="";
		$mainpart=$allabout;
		$mainpartsubject="aboutus";
		$filename="../aboutus.html";
		writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,
$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$ls_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
	 	 if($ls!="all" && $ls!="all_products")
 {break;}	
 
	case "feedback":  //生成 feedback
		
		$index_path="../".$templates_var."/feedback.html";	//模板地址
		$ls_title=$config_rows['companyName'];//title
		$ls_keywords=$config_rows['siteKeywords'];	//Keywords
		$ls_description=$config_rows['siteDescription'];//Description
			//$ls_cate=$pro_cate;																						//左侧产品类别
			//$ls_menu=$menu_pro;																						//主菜单
		$ls_cate=$s_cate;				//左侧产品类别
		$ls_p_cate=$s_p1_cate;
		$ls_motif=$s_m_cate;
		$ls_menu=$menu;	//主菜单
		$ls_feedback=$config_rows['feedback'] ;//feedback
		$ls_feedbackemail=$config_rows['email'] ;//E-Mail
		$ls_foot=$foot;	//底部信息
		
		$ls_propage="";
		$mainpart=$ls_feedback ;
		$mainpartsubject="feedback";
		$filename = "../feedback.html"; 
		writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,
$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$ls_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);

	 	 if($ls!="all" && $ls!="all_products")
 {break;}	
			

	 
	 case "contactus":  //生成 contact us
			
		$contactus.="Address:".$config_rows['address']."<br>\n";
		$contactus.="Tel:".$config_rows['tel']."<br>\n";
		$contactus.="Fax:".$config_rows['fax']."<br>\n";
		$contactus.="E-Mail:<a href=\"mailto:".$config_rows['email']."\">".$config_rows['email']."</a><br>\n";
		$contactus.="MSN:<a href=\"mailto:".$config_rows['MSN']."\">".$config_rows['MSN']."</a><br>\n";
		$contactus.="URL:<a href=\"http://".$config_rows['website']."\">".$config_rows['website']."</a><br>\n";
		$contactus.=$ContactAttach; //联系我们的附件文字： google地图， 地区环境
		
		$contactus = $config_rows['contact'];
		
		$index_path="../".$templates_var."/contact.html";//模板地址
		
		$information_sql="select * from ls_information where inMenu='contact' ";
		$information_query=$opendb->query($information_sql);
		$information_rows=mysql_fetch_assoc($information_query);
		
		$ls_title=$information_rows['inTitle'];//title
		$ls_keywords=$information_rows['inKeywords'];	//Keywords
		$ls_description=$information_rows['inDescription'];//Description
		
		//$ls_cate=$pro_cate;																						//左侧产品类别
		//$ls_menu=$menu_pro;																						//主菜单
		$ls_cate=$s_cate;	//左侧产品类别
		$ls_p_cate=$s_p1_cate;
		$ls_motif=$s_m_cate;
		$ls_menu=$menu;	//主菜单
		$ls_contactus= str_replace("../", "", $information_rows['content']);//contact us
		$ls_foot=$foot;//底部信息
		
		$ls_propage="";
		$ls_feedbackemail="";
		$mainpart=$ls_contactus;
		$mainpartsubject="contactus";
		$filename = "../contact.html"; 
		writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,
$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$ls_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
	 	 if($ls!="all" && $ls!="all_products")
 {break;}	

	case "news": //生成新闻 News
	$news_cate_sql2="select * from `ls_functioncates` where functionName='新闻分类' and enable=1 order by Num asc ";

	$result_cate=$opendb->query($news_cate_sql2);
	$num_cate=mysql_num_rows($result_cate);
	 //$catenews = mysql_fetch_assoc($result_cate);
	$i_news=1;
	// 遍历所有分类 cate, 按分类生成 相关分类的news index.php，如 index_all.html, index_tieshi.html
	// 分页显示，以及全部新闻内容页 newsshow.html
	
	$sort='';	
	while($catenews = mysql_fetch_assoc($result_cate))
	{
		 //$mido = "<h3>".$catenews['cateName']."</h3>";
		 $news_sql2="select * from ls_news where enable=1 and cate='".$catenews['cateName']."' order by Num desc ";
 		 $suffix_str2=$catenews['suffStr'];
		 
		 $result=$opendb->query($news_sql2);
		$mynum = mysql_num_rows($result);//总产品数
			// 每页数量
		$onepage = $PageNumNews;
			//共有页数
		$allpages = ceil($mynum/$onepage);
			
		//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
		//页码计算  在ls_syscode里面
		
		for ($i=0; $i<= $allpages; $i++){
			$newslist="";
			$suffix_str=$suffix_str2;
			if($i == 0)
			{
				$suffix_str = $suffix_str;
			} 
			else 
			{
				$suffix_str = $suffix_str."-".$i;
			}
			$start = $i * $onepage;
			$propage=getPagess("news".$catenews['suffStr'].".html",$allpages,$i+1);	
			
			//查询产品
			$news_sql=$news_sql2." limit ".$start.",".$onepage." ";
			
		$mido = "";
		$news_query=$opendb->query($news_sql);
		while($news_rows=mysql_fetch_assoc($news_query))
		{
			$mido.="<li><span>(".$news_rows['newsDate'].")</span><a href=\"".$newsshowFolders."/news".$suffix_str2.$news_rows['ID'].".html\">".$news_rows['newsTitle']."</a></li>";
			
			$index_newspath="../".$templates_var."/newsshow".$suffix_str2.".html";		//模板地址
			if(file_exists($index_newspath)){
				$newstag=$news_rows['cate'];
				$newstitle=$news_rows['newsTitle'];
				$newstext=$news_rows['newsText'];
				$ls_newstime = $news_rows['newsDate'];
				$ls_newid = $news_rows['ID'];
				$ls_click_n = $news_rows['clickNum'];
				createFolder("../".$newsshowFolders);
				
				
				$ls_title = $news_rows['title'];				//title
				$ls_keywords=$news_rows['keywords'];			//Keywords
				$ls_description=$news_rows['description'];	//Description
				$ls_cate=$pro_cate;
				$ls_s_cate=$s_pro_cate;								//左侧产品类别;
				$ls_s_news = $ls_h1_news;
				$ls_p_cate=$s_p_cate;								//左侧产品类别;
				$ls_f_cate=get_pro_cate(1);
				$ls_motif=$s_m2_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_s_cate}",$ls_s_cate,$newscontent);
				$newscontent = str_replace("{ls_p_cate}",$ls_p_cate,$newscontent);
				$newscontent = str_replace("{ls_f_cate}",$ls_f_cate,$newscontent);
				$newscontent = str_replace("{ls_motif}",$ls_motif,$newscontent);
				$newscontent = str_replace("{ls_propage}",$ls_propage,$newscontent);
				$ls_facebook_twitter = $facebook_twitter;
				$newscontent = str_replace("{ls_weibo}",$ls_facebook_twitter,$newscontent);
				$ls_facebook_twitter_share = $facebook_twitter_share;
				$newscontent = str_replace("{ls_weiboshare}",$ls_facebook_twitter_share,$newscontent);
				
				$ls_indicatebar = "<li><a href=\"../index.html\">Home</a></li>
								   <li style='text-transform : capitalize;'><a href=\"../news".$suffix_str2.".html\">".$suffix_str2."</a></li>";
				$newscontent = str_replace("{ls_indicatebar}",$ls_indicatebar,$newscontent);
				
				$newscontent = str_replace("{ls_news}",$ls_s_news,$newscontent);
				
				$newscontent = str_replace("{ls_newstime}",$ls_newstime,$newscontent);
				$newscontent = str_replace("{ls_newid}",$ls_newid,$newscontent);
				$newscontent = str_replace("{ls_click_n}",$ls_click_n,$newscontent);
				
				$newscontent = str_replace("{ls_newstitle}",$ls_newstitle,$newscontent);
				$newscontent = str_replace("{ls_newstext}",$ls_newstext,$newscontent);
				$newscontent = str_replace("{ls_newsdongtai}",$ls_newsdongtai2,$newscontent);		//子目录下新闻
	//new
				$newscontent = str_replace("{ls_newsgonggao}",$ls_newsgonggao2,$newscontent);
				$newscontent = str_replace("{ls_newsall}",$ls_newsall2,$newscontent);
				$newscontent = str_replace("{ls_newstieshi}",$ls_newstieshi2,$newscontent);
				$newscontent = str_replace("{ls_site_cate}",$s_site_cate,$newscontent);
	
				$newscontent = str_replace("{ls_url}",$ls_url,$newscontent);
				$newscontent = str_replace("{ls_foot}",$ls_foot,$newscontent);
				$newscontent = str_replace("{ls_addprolink}",$ls_addprolink,$newscontent);	//指向主菜单中的Products链接
				$newscontent = str_replace("{ls_addnewprolink}",$ls_addnewprolink,$newscontent);	//指向主菜单中的NewProducts链接
				
				$newscontent = circleNavigationLinkNews($news_rows['ID'],'F','{ls_nextlink}',$newscontent,"ls_news",$catenews['cateName'],"news",$suffix_str2,true);
				$newscontent = circleNavigationLinkNews($news_rows['ID'],'B','{ls_previouslink}',$newscontent,"ls_news",$catenews['cateName'],"news",$suffix_str2,true);
				
				$newscontent = str_replace("{newstag}",$newstag,$newscontent);
				if($suffix_str == "_dongtai"){
					$newscontent = str_replace("<li id=\"current\"><a href=\"../news.html\">","<li><a href=\"../news.html\">",$newscontent);
					$newscontent = str_replace("<li><a href=\"../technology.html\">","<li id=\"current\"><a href=\"../technology.html\">",$newscontent);
				}
						
				$filename="../".$newsshowFolders."/news".$suffix_str2.$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 "'生成文件".$filename."失败！";
				 } 
				fclose ($handle); //关闭指针
				 //echo "创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\"><u>返回</u></a><br/><br/>";
				fclose ($fp);
			}else{
				echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";	
			}
					
		}
		
	//end for , all pages
	
$index_path="../".$templates_var."/news".$suffix_str2.".html";												  //模板地址
		$ls_title=$config_rows['companyName'];												//title
		$ls_keywords=$config_rows['siteKeywords'];										//Keywords
		$ls_description=$config_rows['siteDescription'];							//Description
		$ls_cate=$cate;																								//左侧产品类别
		$ls_motif=$s_m_cate;
		$ls_menu=$menu;																								//主菜单
		$ls_newslist=$mido ;																			//新闻news 列表
		$ls_propage=$propage;																					//新闻分页页码
		$ls_foot=$foot;																								//底部信息
		
		$ls_feedbackemail="";
		$mainpart=$ls_newslist ;
		$mainpartsubject="news";
		$filename = "../news".$suffix_str.".html";
		writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,
$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
	}//end of while all news cats
}
		echo "共有".$mynum."条新闻。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
	 if($ls!="all" && $ls!="all_products")
 {break;}
 
 
 case "faq": //生成常见问题 faq

	$news_cate_sql2="select * from `ls_functioncates` where functionName='常见问题' and enable=1 order by Num asc ";

	$result_cate=$opendb->query($news_cate_sql2);
	$num_cate=mysql_num_rows($result_cate);
	 //$catenews = mysql_fetch_assoc($result_cate);
	$i_news=1;
	// 遍历所有分类 cate, 按分类生成 相关分类的news index.php，如 index_all.html, index_tieshi.html
	// 分页显示，以及全部新闻内容页 newsshow.html
	
	$sort='';	
	while($catenews = mysql_fetch_assoc($result_cate))
	{
		 //$mido = "<h3>".$catenews['cateName']."</h3>";
		 $news_sql2="select * from ls_news where enable=1 and cate='".$catenews['cateName']."' order by Num desc ";
 		 $suffix_str2=$catenews['suffStr'];
		 
		 $result=$opendb->query($news_sql2);
		$mynum = mysql_num_rows($result);//总产品数
			// 每页数量
		$onepage = $PageNumFaq;
			//共有页数
		$allpages = ceil($mynum/$onepage);
			
		//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
		//页码计算  在ls_syscode里面
		
		for ($i=0; $i<= $allpages; $i++){
			$newslist="";
			$suffix_str=$suffix_str2;
			if($i == 0)
			{
				$suffix_str = $suffix_str;
			} 
			else 
			{
				$suffix_str = $suffix_str."-".$i;
			}
			$start = $i * $onepage;
			$propage=getPagess("faq".$catenews['suffStr'].".html",$allpages,$i+1);
			
			//查询产品
			$news_sql=$news_sql2." limit ".$start.",".$onepage." ";
			
		$mido = "";
		$news_query=$opendb->query($news_sql);
		while($news_rows=mysql_fetch_assoc($news_query))
		{
			/*$mido.="<li><div class='art_title')'><span>(".$news_rows['newsDate'].")</span><a href=\"".$faqshowFolders."/faq".$suffix_str2.$news_rows['ID'].".html\" onclick='loadfaq(".$news_rows['ID'].">".$news_rows['newsTitle']."</a></div>
			<div class='art_content' id='applyfaq".$news_rows['ID']."'>".$news_rows['newsText']."</div>
			</li>";*/
			
			$mido.="<li><div class='art_title2' id=\"faq".$news_rows['ID']."\"><a href=\"javascript:void(0)\" onclick='loadfaq(".$news_rows['ID'].")'>".$news_rows['newsTitle']."</a></div>
			<div class='art_content' id='applyfaq".$news_rows['ID']."'>".$news_rows['newsText']."</div>
			</li>";
			
			$index_newspath="../".$templates_var."/faqshow".$suffix_str2.".html";		//模板地址
			if(file_exists($index_newspath)){
				$newstag=$news_rows['cate'];
				$newstitle=$news_rows['newsTitle'];
				$newstext=$news_rows['newsText'];
				$ls_newstime = $news_rows['newsDate'];
				$ls_newid = $news_rows['ID'];
				$ls_click_n = $news_rows['clickNum'];
				createFolder("../".$faqshowFolders);
				
				
				$ls_title = $news_rows['title'];				//title
				$ls_keywords=$news_rows['keywords'];			//Keywords
				$ls_description=$news_rows['description'];	//Description
				$ls_cate=$pro_cate;
				$ls_s_cate=$s_pro_cate;								//左侧产品类别;
				$ls_s_news = $ls_h1_news;
				$ls_p_cate=$s_p_cate;								//左侧产品类别;
				$ls_f_cate=get_pro_cate(1);
				$ls_motif=$s_m2_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_s_cate}",$ls_s_cate,$newscontent);
				$newscontent = str_replace("{ls_p_cate}",$ls_p_cate,$newscontent);
				$newscontent = str_replace("{ls_f_cate}",$ls_f_cate,$newscontent);
				$newscontent = str_replace("{ls_motif}",$ls_motif,$newscontent);
				$newscontent = str_replace("{ls_propage}",$ls_propage,$newscontent);
				$ls_facebook_twitter = $facebook_twitter;
				$newscontent = str_replace("{ls_weibo}",$ls_facebook_twitter,$newscontent);
				$ls_facebook_twitter_share = $facebook_twitter_share;
				$newscontent = str_replace("{ls_weiboshare}",$ls_facebook_twitter_share,$newscontent);
				
				$ls_indicatebar = "<li><a href=\"../index.html\">Home</a></li>
								   <li style='text-transform : capitalize;'><a href=\"../news".$suffix_str2.".html\">".$suffix_str2."</a></li>";
				$newscontent = str_replace("{ls_indicatebar}",$ls_indicatebar,$newscontent);
				
				$newscontent = str_replace("{ls_news}",$ls_s_news,$newscontent);
				
				$newscontent = str_replace("{ls_newstime}",$ls_newstime,$newscontent);
				$newscontent = str_replace("{ls_newid}",$ls_newid,$newscontent);
				$newscontent = str_replace("{ls_click_n}",$ls_click_n,$newscontent);
				
				$newscontent = str_replace("{ls_newstitle}",$ls_newstitle,$newscontent);
				$newscontent = str_replace("{ls_newstext}",$ls_newstext,$newscontent);
				$newscontent = str_replace("{ls_newsdongtai}",$ls_newsdongtai2,$newscontent);		//子目录下新闻
	//new
				$newscontent = str_replace("{ls_newsgonggao}",$ls_newsgonggao2,$newscontent);
				$newscontent = str_replace("{ls_newsall}",$ls_newsall2,$newscontent);
				$newscontent = str_replace("{ls_newstieshi}",$ls_newstieshi2,$newscontent);
				$newscontent = str_replace("{ls_site_cate}",$s_site_cate,$newscontent);
	
				$newscontent = str_replace("{ls_url}",$ls_url,$newscontent);
				$newscontent = str_replace("{ls_foot}",$ls_foot,$newscontent);
				$newscontent = str_replace("{ls_addprolink}",$ls_addprolink,$newscontent);	//指向主菜单中的Products链接
				$newscontent = str_replace("{ls_addnewprolink}",$ls_addnewprolink,$newscontent);	//指向主菜单中的NewProducts链接
				
				$newscontent = circleNavigationLinkNews($news_rows['ID'],'F','{ls_nextlink}',$newscontent,"ls_news",$catenews['cateName'],"faq",$suffix_str2,true);
				$newscontent = circleNavigationLinkNews($news_rows['ID'],'B','{ls_previouslink}',$newscontent,"ls_news",$catenews['cateName'],"faq",$suffix_str2,true);
				
				$newscontent = str_replace("{newstag}",$newstag,$newscontent);
				if($suffix_str == "_dongtai"){
					$newscontent = str_replace("<li id=\"current\"><a href=\"../news.html\">","<li><a href=\"../news.html\">",$newscontent);
					$newscontent = str_replace("<li><a href=\"../technology.html\">","<li id=\"current\"><a href=\"../technology.html\">",$newscontent);
				}
						
				$filename="../".$faqshowFolders."/faq".$suffix_str2.$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 "'生成文件".$filename."失败！";
				 } 
				fclose ($handle); //关闭指针
				 //echo "创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\"><u>返回</u></a><br/><br/>";
				fclose ($fp);
			}else{
				echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";
			}
		}
		
	//end for , all pages
	
$index_path="../".$templates_var."/faq".$suffix_str2.".html";												  //模板地址
		$ls_title=$config_rows['companyName'];												//title
		$ls_keywords=$config_rows['siteKeywords'];										//Keywords
		$ls_description=$config_rows['siteDescription'];							//Description
		$ls_cate=$cate;																								//左侧产品类别
		$ls_motif=$s_m_cate;
		$ls_menu=$menu;																								//主菜单
		$ls_newslist=$mido ;																			//新闻news 列表
		$ls_propage=$propage;																					//新闻分页页码
		$ls_foot=$foot;																								//底部信息
		
		$ls_feedbackemail="";
		$mainpart=$ls_newslist ;
		$mainpartsubject="faq";
		$filename = "../faq".$suffix_str.".html";
		writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,
$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
	}//end of while all news cats
}
  		echo "共有".$mynum."条常见问题。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
	
	//end of while all news cats

	 if($ls!="all" && $ls!="all_products")
 {break;}
 
 case "blog": //生成博客 Blog
	
	$news_cate_sql2="select * from `ls_functioncates` where functionName='博客分类' and enable=1 order by Num asc ";

	$result_cate=$opendb->query($news_cate_sql2);
	$num_cate=mysql_num_rows($result_cate);
	 //$catenews = mysql_fetch_assoc($result_cate);
	$i_news=1;
	// 遍历所有分类 cate, 按分类生成 相关分类的news index.php，如 index_all.html, index_tieshi.html
	// 分页显示，以及全部新闻内容页 newsshow.html
	
	//博客友情链接
	$links_sql = "select * from ls_links where enable = 1 and cateName = 'Blog'";
	$links_query = $opendb->query($links_sql);
	while($links_rows=mysql_fetch_assoc($links_query)){
		$links_str .= "<li><a href ='".$links_rows['linkURL']."' target='_blank'>".$links_rows['linkTitle']."</a></li>";
	}
	$ls_links = $links_str;
	$ls_s_news = $ls_h1_news;
	$blog_path="../".$templates_var."/blogindex.html";
	if(file_exists($blog_path)){
		createFolder("../".$blogFolders);
		
		$fp	   = fopen ($blog_path,"r");
		$blogcontent = fread ($fp,filesize ($blog_path));
		//$blogcontent = str_replace("../","",$blogcontent);
		$blogcontent = str_replace("{ls_title}",$ls_title,$blogcontent);
		$blogcontent = str_replace("{ls_keywords}",$ls_keywords,$blogcontent);
		$blogcontent = str_replace("{ls_description}",$ls_description,$blogcontent);
		$blogcontent = str_replace("{ls_menu}",$ls_menu,$blogcontent);
		$blogcontent = str_replace("{ls_cate}",$ls_cate,$blogcontent);
		$blogcontent = str_replace("{ls_s_cate}",$ls_s_cate,$blogcontent);
		$blogcontent = str_replace("{ls_p_cate}",$ls_p_cate,$blogcontent);
		$blogcontent = str_replace("{ls_f_cate}",$ls_f_cate,$blogcontent);
		$blogcontent = str_replace("{ls_motif}",$ls_motif,$blogcontent);
		$blogcontent = str_replace("{ls_news}",$ls_s_news,$blogcontent);
		$blogcontent = str_replace("{ls_propage}",$ls_propage,$blogcontent);
		$ls_facebook_twitter = $facebook_twitter;
		$blogcontent = str_replace("{ls_weibo}",$ls_facebook_twitter,$blogcontent);
		$ls_facebook_twitter_share = $facebook_twitter_share;
		$blogcontent = str_replace("{ls_weiboshare}",$ls_facebook_twitter_share,$blogcontent);
		$blogcontent = str_replace("{ls_links}",$ls_links,$blogcontent);
		$blogcontent = str_replace("{ls_addprolink}",$ls_addprolink,$blogcontent);	//指向主菜单中的Products链接
		$blogcontent = str_replace("{ls_addnewprolink}",$ls_addnewprolink,$blogcontent);	//指向主菜单中的NewProducts链接
		$bcate = $blogcontent;
		$sort='';
		
		//博客首页不分类别输出前N条最新博客 start
		$p22 = "%<ls_foreach>(.*?)</ls_foreach>%si";    //正则表达式
		preg_match_all($p22, $bcate, $arr);
		$bloginarr = $arr[1][0];
		
		$news_sql3="select * from ls_functioncates, ls_news where ls_news.enable=1 and ls_functioncates.cateName = ls_news.cate and ls_functioncates.functionName = '博客分类' order by ls_news.Num desc ";
		$news_query3=$opendb->query($news_sql3);
		$mido = "";
		$blog_i = 0;
		while($news_rows3=mysql_fetch_assoc($news_query3)){
			$suffix_str2 = $news_rows3['suffStr'];
			$blog_i++;
			if(strpos($news_rows3['newsText'],'<img') !== false){
				
				$newsImgStr=getStrbyTag("<img ","/>",$news_rows3['newsText']);
				$imgHeight=getStrbyTag('height="','" ',$newsImgStr,false);
				$imgWidth=getStrbyTag('width="','" ',$newsImgStr,false);
				$newsImg=getStrbyTag('src="','" ',$newsImgStr);
				$srcImg = getSubstr($newsImg,"src=\"",'"');
				$srcImg = strtolower(getSubstr($newsImg,'src="','"'));  //变小写，清除 src= " 等
				$imgurl = $srcImg;
				$srcImg = str_replace('src=','',$srcImg);
				$srcImg = str_replace('"','',$srcImg);

				$proportion = " width='220' height='180' ";
				$blogimg = $proportion.$newsImg;
			}else{
				$blogimg="src=\"../ls_admin/images/blog.jpg\" width='220'";
			}
	
			$blogimg = "<a href=\"blog".$suffix_str2.$news_rows3['ID'].".html\"><img ".$blogimg." /></a>";
			$blogtime = $news_rows3['newsDate'];
			$blogtitle = "<a href=\"blog".$suffix_str2.$news_rows3['ID'].".html\">".$news_rows3['newsTitle']."</a>";
			$blogtext = mb_substr(strip_tags($news_rows3['newsText']),0,$blog_descrption_num,'utf-8').((strlen(strip_tags($news_rows3['newsText']))>$blog_descrption_num)?" <a href=\"blog".$suffix_str2.$news_rows3['ID'].".html\">(More...)</a>":"");
			
			$blogindexstr = "";
			
			if($blog_i <= $blog_index_num){
				$blogindexstr = str_replace("{ls_blogimg}",$blogimg,$bloginarr);
				$blogindexstr = str_replace("{ls_blogtime}",$blogtime,$blogindexstr);
				$blogindexstr = str_replace("{ls_blogtitle}",$blogtitle,$blogindexstr);
				$blogindexstr = str_replace("{ls_blogtext}",$blogtext,$blogindexstr);
				
				$blogindex2 .= $blogindexstr;
			}
			
		}
		//博客首页不分类别输出前N条最新博客 end
		
		$p = "%<ls_blogcate>(.*?)</ls_blogcate>%si";    //正则表达式
		preg_match_all($p, $bcate, $arr);
		$blogcatearr = $arr[1];
		foreach($blogcatearr as $val){
			//echo $val."&&&&&&&&&&&&&&";
			$blog22 = "";
			$result_cate2=$opendb->query($news_cate_sql2);
			while($catenews = mysql_fetch_assoc($result_cate2))
			{
				//$mido = "<h3>".$catenews['cateName']."</h3>";
				$news_sql2="select * from ls_news where enable=1 and cate='".$catenews['cateName']."' order by Num desc ";
				$suffix_str2=$catenews['suffStr'];
				
				$cate_val = str_replace("{ls_blogtag}",$catenews['cateName'],$val);
				$cate_val = str_replace("{ls_blogmore}","blog".$catenews['suffStr'].".html",$cate_val);
				
				//echo $cate_val."****************";
				$p2 = "%<ls_foreach>(.*?)</ls_foreach>%si";    //正则表达式
				preg_match_all($p2, $cate_val, $arr);
				$blogarr = $arr[1][0];
				//echo $blogarr."%%%%%%%%%%%%%%%%%%";
				
				$result=$opendb->query($news_sql2);
				$mynum = mysql_num_rows($result);//总产品数
					// 每页数量
				$onepage = $PageNumNews;
					//共有页数
				$allpages = ceil($mynum/$onepage);
					
				//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
				//页码计算  在ls_syscode里面
				$blogindex = "";
				for ($i=0; $i<= $allpages; $i++){
					$newslist="";
					$suffix_str=$suffix_str2;
					if($i == 0)
					{
						$suffix_str = $suffix_str;
					} 
					else 
					{
						$suffix_str = $suffix_str."-".$i;
					}
					$start = $i * $onepage;
					$propage=getPagess("blog".$catenews['suffStr'].".html",$allpages,$i+1);	
					
					//查询产品
					$news_sql=$news_sql2." limit ".$start.",".$onepage." ";
					
				$index_path="../".$templates_var."/bloglist.html";
				if(file_exists($index_path)){
					$fp	   = fopen ($index_path,"r");
					$content = fread($fp,filesize ($index_path));
			
					$p3 = "%<ls_foreach>(.*?)</ls_foreach>%si";    //正则表达式
					preg_match_all($p3, $content, $arr);
					$temarr = $arr[1][0];
					
					$news_query=$opendb->query($news_sql);
					$mido = "";
					$blog_i = 0;
					while($news_rows=mysql_fetch_assoc($news_query))
					{
						$blog_i++;
						if(strpos($news_rows['newsText'],'<img') !== false){
							
							$newsImgStr=getStrbyTag("<img ","/>",$news_rows['newsText']);
							$imgHeight=getStrbyTag('height="','" ',$newsImgStr,false);
							$imgWidth=getStrbyTag('width="','" ',$newsImgStr,false);
							$newsImg=getStrbyTag('src="','" ',$newsImgStr);
							$srcImg = getSubstr($newsImg,"src=\"",'"');
							$srcImg = strtolower(getSubstr($newsImg,'src="','"'));  //变小写，清除 src= " 等
							$imgurl = $srcImg;
							$srcImg = str_replace('src=','',$srcImg);
							$srcImg = str_replace('"','',$srcImg);
							
							$proportion = " width='220' height='180' ";
							$blogimg = $proportion.$newsImg;
						}else{
							$blogimg="src=\"../ls_admin/images/blog.jpg\" width='220'";
						}
			
						$blogimg = "<a href=\"blog".$suffix_str2.$news_rows['ID'].".html\"><img ".$blogimg." /></a>";
						$blogtime = $news_rows['newsDate'];
						$blogtitle = "<a href=\"blog".$suffix_str2.$news_rows['ID'].".html\">".$news_rows['newsTitle']."</a>";
						$blogtext = mb_substr(strip_tags($news_rows['newsText']),0,$blog_descrption_num,'utf-8').((strlen(strip_tags($news_rows['newsText']))>$blog_descrption_num)?" <a href=\"blog".$suffix_str2.$news_rows['ID'].".html\">(More...)</a>":"");
						
						$blogstr = str_replace("{ls_blogimg}",$blogimg,$temarr);
						$blogstr = str_replace("{ls_blogtime}",$blogtime,$blogstr);
						$blogstr = str_replace("{ls_blogtitle}",$blogtitle,$blogstr);
						$blogstr = str_replace("{ls_blogtext}",$blogtext,$blogstr);
						
						$mido .= $blogstr;
						$blogindexstr = "";
						
						if($blog_i <= $blog_index_num){
							$blogindexstr = str_replace("{ls_blogimg}",$blogimg,$blogarr);
							$blogindexstr = str_replace("{ls_blogtime}",$blogtime,$blogindexstr);
							$blogindexstr = str_replace("{ls_blogtitle}",$blogtitle,$blogindexstr);
							$blogindexstr = str_replace("{ls_blogtext}",$blogtext,$blogindexstr);
							
							$blogindex .= $blogindexstr;
						}
						$index_newspath="../".$templates_var."/blogshow.html";		//模板地址
						if(file_exists($index_newspath)){
							$newstag=$news_rows['cate'];
							$newstitle=$news_rows['newsTitle'];
							$newstext=$news_rows['newsText'];
							$ls_newstime = $news_rows['newsDate'];
							$ls_newid = $news_rows['ID'];
							$ls_click_n = $news_rows['clickNum'];
							createFolder("../".$newsshowFolders);
							
							
							$ls_title = $news_rows['title'];				//title
							$ls_keywords=$news_rows['keywords'];			//Keywords
							$ls_description=$news_rows['description'];	//Description
							$ls_cate=$pro_cate;
							$ls_s_cate=$s_pro_cate;								//左侧产品类别;
							$ls_p_cate=$s_p_cate;								//左侧产品类别;
							$ls_f_cate=get_pro_cate(1);
							$ls_motif=$s_m2_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_s_cate}",$ls_s_cate,$newscontent);
							$newscontent = str_replace("{ls_p_cate}",$ls_p_cate,$newscontent);
							$newscontent = str_replace("{ls_f_cate}",$ls_f_cate,$newscontent);
							$newscontent = str_replace("{ls_motif}",$ls_motif,$newscontent);
							$newscontent = str_replace("{ls_propage}",$ls_propage,$newscontent);
							$newscontent = str_replace("{ls_weibo}",$ls_facebook_twitter,$newscontent);
							$ls_facebook_twitter_share = $facebook_twitter_share;
							$newscontent = str_replace("{ls_weiboshare}",$ls_facebook_twitter_share,$newscontent);
							
							$ls_indicatebar = "<li><a href=\"../index.html\">Home</a></li>
											   <li style='text-transform : capitalize;'><a href=\"../news".$suffix_str2.".html\">".$suffix_str2."</a></li>";
							$newscontent = str_replace("{ls_indicatebar}",$ls_indicatebar,$newscontent);
							
							$newscontent = preg_replace("%<ls_blogcate>(.*?)</ls_blogcate>%si", get_blog_cate($index_newspath), $newscontent);
							
							$newscontent = str_replace("{ls_blogtag}",$catenews['cateName'],$newscontent);
							$newscontent = str_replace("{ls_blogmore}","blog".$catenews['suffStr'].".html",$newscontent);
							
							$newscontent = str_replace("{ls_news}",$ls_s_news,$newscontent);
							
							$newscontent = str_replace("{ls_newstime}",$ls_newstime,$newscontent);
							$newscontent = str_replace("{ls_newid}",$ls_newid,$newscontent);
							$newscontent = str_replace("{ls_click_n}",$ls_click_n,$newscontent);
							
							$newscontent = str_replace("{ls_newstitle}",$ls_newstitle,$newscontent);
							$newscontent = str_replace("{ls_newstext}",$ls_newstext,$newscontent);
							$newscontent = str_replace("{ls_newsdongtai}",$ls_newsdongtai2,$newscontent);		//子目录下新闻
				//new
							$newscontent = str_replace("{ls_newsgonggao}",$ls_newsgonggao2,$newscontent);
							$newscontent = str_replace("{ls_links}",$ls_links,$newscontent);
							$newscontent = str_replace("{ls_newsall}",$ls_newsall2,$newscontent);
							$newscontent = str_replace("{ls_newstieshi}",$ls_newstieshi2,$newscontent);
							$newscontent = str_replace("{ls_site_cate}",$s_site_cate,$newscontent);
				
							$newscontent = str_replace("{ls_url}",$ls_url,$newscontent);
							$newscontent = str_replace("{ls_foot}",$ls_foot,$newscontent);
							$newscontent = str_replace("{ls_addprolink}",$ls_addprolink,$newscontent);	//指向主菜单中的Products链接
							$newscontent = str_replace("{ls_addnewprolink}",$ls_addnewprolink,$newscontent);	//指向主菜单中的NewProducts链接
							
							$newscontent = circleNavigationLinkNews($news_rows['ID'],'F','{ls_nextlink}',$newscontent,"ls_news",$catenews['cateName'],"blog",$suffix_str2,true);
							$newscontent = circleNavigationLinkNews($news_rows['ID'],'B','{ls_previouslink}',$newscontent,"ls_news",$catenews['cateName'],"blog",$suffix_str2,true);
							
							$newscontent = str_replace("{newstag}",$newstag,$newscontent);
							if($suffix_str == "_dongtai"){
								$newscontent = str_replace("<li id=\"current\"><a href=\"../news.html\">","<li><a href=\"../news.html\">",$newscontent);
								$newscontent = str_replace("<li><a href=\"../technology.html\">","<li id=\"current\"><a href=\"../technology.html\">",$newscontent);
							}
									
							$filename="../".$blogFolders."/blog".$suffix_str2.$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 "'生成文件".$filename."失败！";
							 } 
							fclose ($handle); //关闭指针
							 //echo "创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\"><u>返回</u></a><br/><br/>";
							fclose ($fp);
						}else{
							echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";
						}
					}
					echo "共有".$mynum."条博客。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
				}else{
					echo "<p>模版文件".$index_path."不存在，请设计好模板后重新生成。</p>";
				}
				
				$blog123 = str_replace("<ls_foreach>".$blogarr."</ls_foreach>", $blogindex, $cate_val);
				
				$ls_title=$config_rows['companyName'];												//title
				$ls_keywords=$config_rows['siteKeywords'];										//Keywords
				$ls_description=$config_rows['siteDescription'];							//Description
				$ls_cate=$cate;																								//左侧产品类别
				$ls_motif=$s_m_cate;
				$ls_menu=$menu;																								//主菜单
				$ls_newslist=$mido;																			//新闻news 列表
				$ls_propage=$propage;																					//新闻分页页码
				$ls_foot=$ls_links;																								//底部信息
				
				$ls_feedbackemail="";
				$mainpart=$ls_newslist ;
				$mainpartsubject="blog";
				$filename = "../".$blogFolders."/blog".$suffix_str.".html";
				writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,
		$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
			}//end of while all news cats
			$blog22 .= $blog123;
		  }
		  $blogcontent = str_replace("<ls_foreach>".$bloginarr."</ls_foreach>", $blogindex2, $blogcontent);
		  $blogcontent = str_replace("<ls_blogcate>".$val."</ls_blogcate>", $blog22, $blogcontent);
		}
		$filename="../".$blogFolders."/index.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,$blogcontent)){  //将信息写入文件
			echo "'生成文件".$filename."失败！";
		 } 
		fclose ($handle); //关闭指针
		 //echo "创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\"><u>返回</u></a><br/><br/>";
		fclose ($fp);
	}else{
		echo "<p>模版文件".$blog_path."不存在，请设计好模板后重新生成。</p>";
	}
	
	 if($ls!="all" && $ls!="all_products")
 {break;}
	 
	case "download": //生成下载
		
		$news_sql2="select * from ls_download where enable=1 order by ID desc ";
	  	$result=$opendb->query($news_sql2);
		$mynum = mysql_num_rows($result);//总产品数
		// 每页数量
		$onepage = $PageNumDowbloads; 
		//共有页数
		$allpages = ceil($mynum/$onepage);
		
		//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			$propage=getPages("download.html",$allpages);
			//页码计算
			
		for ($i=0; $i<= $allpages; $i++)
		{ 
			if ($i == 0)
			{ 
			$indexpath = "download.html";
		  	} 
		  	else 
		  	{ 
				$indexpath = "download-".$i.".html";
		  	}
			 $start = $i * $onepage;
			 $downlist="";
		 //查询产品
		 
		 $news_sql=$news_sql2. " limit ".$start.",".$onepage." ";
		// echo $news_sql;
			 $news_query=$opendb->query($news_sql);
	
			 while($news_rows=mysql_fetch_assoc($news_query))
			{
					$down_size = round($news_rows['downloadSize']/1000);
					if($down_size > 1048576){
						$size = sprintf("%.2f", $value1['downloadSize']/1048576)."MB";
					}else{
						$size = $down_size."KB";
					}
					$downlist.="<li><span style=\"float:right;\">".$size."</span><a href=\"".$downloadFolders."/".$news_rows['downloadName']."\" onclick='$.download_times(".$news_rows['ID'].")' title=\"Size:".$size."\">".$news_rows['downloadTitle']."</a></li>";
				}
				$index_path="../".$templates_var."/download.html";		  //模板地址
				$ls_title=$config_rows['companyName'];				//title
				$ls_keywords=$config_rows['siteKeywords'];			//Keywords
				$ls_description=$config_rows['siteDescription'];	//Description
				$ls_cate=$cate;																								//左侧产品类别
				$ls_motif=$s_m_cate;
				$ls_menu=$menu;																								//主菜单
				$ls_downlist=$downlist ;																			//新闻news 列表
				$ls_propage=$propage;																					//新闻分页页码
				$ls_foot=$foot;																								//底部信息
				
		$ls_feedbackemail="";
		$mainpart=$ls_downlist;
		$mainpartsubject="download";
		$filename = "../".$indexpath;
		writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,
$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);

		}
	
	  		
	  	echo "共有".$mynum."条下载。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
		 if($ls!="all" && $ls!="all_products")
 {break;}
		
	case "management": //生成管理团队(Management)
	
	$news_sql3="select * from ls_menu where menuName='Management'";
	$news_query3=$opendb->query($news_sql3);
	$news_rows3=mysql_fetch_assoc($news_query3);
	$introduction = $news_rows3['description'];
			
	$news_sql2="select * from ls_management where enable=1 order by Num desc ";
	  $result=$opendb->query($news_sql);
		$mynum = mysql_num_rows($result);//总产品数
		// 每页数量
		$onepage = $PageNum; 
		//共有页数
		$allpages = ceil($mynum/$onepage);
		
		//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			$propage=getPages("management.html",$allpages);
			//页码计算
			
			for ($i=0; $i<= $allpages; $i++)
			{ 
			if ($i == 0)
			{ 
			$indexpath = "management.html";
		  } 
		  else 
		  { 
			$indexpath = "management-".$i.".html";
		  }
		 $start = $i * $onepage;
		 //查询产品
		 
		 $news_sql=$news_sql2." limit ".$start.",".$onepage." ";
			 $news_query=$opendb->query($news_sql);
	
			 while($news_rows=mysql_fetch_assoc($news_query))
				{
					$list.="
					<div style=\"border-bottom:1px solid #ccc; margin-left:20px;width:98%;\">
						<div style=\"float:left;padding-left:20px;padding-right:20px;\">
							<a href=\"".$WorkShopFolders."/".$BigFoldersProducts."/".$news_rows['Pic']."\" target=\"_blank\">
							<img src=\"".$WorkShopFolders."/".$SmallFoldersProducts."/".$news_rows['Pic']."\" alt='".$news_rows['Text']."' title='".$news_rows['Text']."' border=\"0\"></a>
						</div>
						<div style=\"float:left;\">
							".$news_rows['Text']."
						</div>
					</div>
					";
				}
				$index_path="../".$templates_var."/management.html";										//模板地址
				$ls_title=$news_rows3['inTitle'];												//title
				$ls_keywords=$news_rows3['inKeywords'];										//Keywords
				$ls_description=$news_rows3['inDescription'];							//Description
				$ls_cate=$cate;																								//左侧产品类别
				$ls_motif=$s_m_cate;
				$ls_menu=$menu;																								//主菜单
				$ls_list=$list ;																			//新闻news 列表
				$ls_propage=$propage;																					//新闻分页页码
				$ls_foot=$foot;																								//底部信息
				
		$ls_feedbackemail="";
		$mainpart=$ls_list;
		$mainpartsubject="management";
		$filename = "../management.html"; 
		writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,
$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);

				}
	  		
	  		echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
		
		 if($ls!="all" && $ls!="all_products")
 {break;}
		
		case "workshop": //生成车间图片(Workshop)
		
			$news_sql3="select * from ls_menu where menuName='workshop'";
			$news_query3=$opendb->query($news_sql3);
			$news_rows3=mysql_fetch_assoc($news_query3);
			$introduction = $news_rows3['description'];
			$introduction =  str_replace("../", "", $introduction);
		
			$news_sql2="select * from ls_workshop where enable=1 order by Num desc ";
	 		$result=$opendb->query($news_sql2);
			$mynum = mysql_num_rows($result);//总产品数
			// 每页数量
			$onepage = $WorkshopPageNum; 
			//共有页数
			$allpages = ceil($mynum/$onepage);

			echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			//$propage=getPages("workshop.html",$allpages);

			//根据页码生成文件名
			for ($i=0; $i<= $allpages; $i++){
				$news_sql2="select * from ls_workshop where enable=1 order by Num desc ";
				if ($i == 0){ 
					$indexpath = "workshop.html";
		 		}else{ 
					$indexpath = "workshop-".$i.".html";
		 		}
				$start = $i * $onepage;
				
				if($allpages!=1){
					$ls_current_page=$i+1;		//当前页码
				}

		 		//查询产品
				$news_sql2.=" limit ".$start.",".$onepage." ";
				$news_query=$opendb->query($news_sql2);
				$list="<ul class=\"p_list\">";
				while($news_rows=mysql_fetch_assoc($news_query)){
					$list.="<div class=\"col-lg-4 col-md-4 col-sm-6 col-xs-12\">
							<div class=\"thumbnail\">
								<div class=\"img-pic\">
							  <a href=\"".$WorkShopFolders."/workshop-page".$news_rows['ID'].".html\"  title=\"".$news_rows['workshopTitle']."\" class=\"c-img-height\"><img src=\"".$WorkShopFolders."/".$SmallFoldersProducts."/".$news_rows['workshopPic']."\" border=\"0\" class='img-responsive' alt=\"".$news_rows['Title']."\" /></a>
							  </div>
							  <div class=\"caption pro-name\">
								<h5><a href=\"".$WorkShopFolders."/workshop-page".$news_rows['ID'].".html\"  title=\"".$news_rows['workshopTitle']."\" >".$news_rows['workshopTitle']."</a></h5>
							  </div>
							</div>
						  </div>";
					
					$newstitle=$news_rows['workshopTitle'];
					$newimg = "<center><img src=\"../".$WorkShopFolders."/".$BigFoldersProducts."/".$news_rows['workshopPic']."\" ondragstart=\"return false;\"/></center>";
					$newstext = $news_rows['workshopText'];
					$ls_newid = $news_rows['ID'];
					createFolder("../".$WorkShopFolders);
					
					$index_newspath="../".$templates_var."/workshopshow.html";		//模板地址
					if(file_exists($index_newspath)){
						$ls_title=$news_rows['newsTitle'];				//title
						$ls_keywords=$news_rows['newsKeywords'];			//Keywords
						$ls_description=$news_rows['newsDescription'];	//Description
						$ls_cate=$pro_cate;
						$ls_s_cate=$s_pro_cate;								//左侧产品类别;
						$ls_motif=$s_m2_cate;
						$ls_menu=$menu_pro;									//主菜单
						$ls_newstitle=$newstitle ;							//新闻标题
						$ls_newimg=$newimg;
						$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_s_cate}",$ls_s_cate,$newscontent);
						
						$ls_d_cate = str_replace("class=\"dropdown\"","",$ls_s_cate);
						$ls_d_cate = str_replace("class=\"sub-menu\"","",$ls_d_cate);
						
						$newscontent  = str_replace("{ls_d_cate}",$ls_d_cate,$newscontent);
						$newscontent = str_replace("{ls_p_cate}",$ls_p_cate,$newscontent);
						
						$newscontent = str_replace("{ls_motif}",$ls_motif,$newscontent);
						$newscontent = str_replace("{ls_propage}",$ls_propage,$newscontent);
						$ls_facebook_twitter = $facebook_twitter;
						$newscontent = str_replace("{ls_weibo}",$ls_facebook_twitter,$newscontent);
						$ls_facebook_twitter_share = $facebook_twitter_share;
						$newscontent = str_replace("{ls_weiboshare}",$ls_facebook_twitter_share,$newscontent);
						
						$newscontent = str_replace("{ls_newstime}",$ls_newstime,$newscontent);
						$newscontent = str_replace("{ls_newid}",$ls_newid,$newscontent);
						$newscontent = str_replace("{ls_click_n}",$ls_click_n,$newscontent);
						
						$ls_indicatebar = "<li><a href=\"../index.html\">Home</a></li>
								   <li><a href=\"../workshop.html\">Workshop</a></li>";
						$newscontent = str_replace("{ls_indicatebar}",$ls_indicatebar,$newscontent);
						
						$newscontent = str_replace("{ls_newstitle}",$ls_newstitle,$newscontent);
						$newscontent = str_replace("{ls_newimg}",$ls_newimg,$newscontent);
						
						$newscontent = str_replace("{ls_newstext}",$ls_newstext,$newscontent);
						$newscontent = str_replace("{ls_newsdongtai}",$ls_newsdongtai2,$newscontent);		//子目录下新闻
			//new
						$newscontent = str_replace("{ls_newsgonggao}",$ls_newsgonggao2,$newscontent);
						$newscontent = str_replace("{ls_newsall}",$ls_newsall2,$newscontent);
						$newscontent = str_replace("{ls_newstieshi}",$ls_newstieshi2,$newscontent);
						$newscontent = str_replace("{ls_site_cate}",$s_site_cate,$newscontent);
			
						$newscontent = str_replace("{ls_url}",$ls_url,$newscontent);
						$newscontent = str_replace("{ls_foot}",$ls_foot,$newscontent);
						$newscontent = str_replace("{ls_addprolink}",$ls_addprolink,$newscontent);	//指向主菜单中的Products链接
						$newscontent = str_replace("{ls_addnewprolink}",$ls_addnewprolink,$newscontent);	//指向主菜单中的NewProducts链接
						
						$newscontent = circleNavigationLinkNews($news_rows['ID'],'B','{ls_nextlink}',$newscontent,"ls_workshop",$catenews['cateName'],"workshop",$suffix_str2,false);
						$newscontent = circleNavigationLinkNews($news_rows['ID'],'F','{ls_previouslink}',$newscontent,"ls_workshop",$catenews['cateName'],"workshop",$suffix_str2,false);
						
						$newscontent = str_replace("{newstag}",$newstag,$newscontent);
						if($suffix_str == "_dongtai"){
							$newscontent = str_replace("<li id=\"current\"><a href=\"../news.html\">","<li><a href=\"../news.html\">",$newscontent);
							$newscontent = str_replace("<li><a href=\"../technology.html\">","<li id=\"current\"><a href=\"../technology.html\">",$newscontent);
						}
								
						$filename="../".$WorkShopFolders."/workshop-page".$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 "'生成文件".$filename."失败！";
						 } 
						fclose ($handle); //关闭指针
						 //echo "创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\"><u>返回</u></a><br/><br/>";
						fclose ($fp);
					}else{
						echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";
					}
				
				}
				$list.="</ul>";
				
				//页码计算
				$propage=getPagess("workshop.html",$allpages,$ls_current_page);
				
				$index_path="../".$templates_var."/workshop.html";				//车间模板地址
				$ls_title=$news_rows3['inTitle'];												//title
				$ls_keywords=$news_rows3['inKeywords'];										//Keywords
				$ls_description=$news_rows3['inDescription'];							//Description
				$ls_cate=$cate;											//左侧产品类别
				$ls_motif=$s_m_cate;
				$ls_menu=$menu;											//主菜单
				$ls_list=$list ;										//车间图片列表
				$ls_introduction=$introduction;                           //车间简介
				$ls_propage=$propage;									//车间分页页码
				$ls_foot=$foot;											//底部信息
				
				$ls_feedbackemail="";
				$mainpart=$ls_list;
				$mainpartsubject="workshop";
				$filename = "../{$indexpath}";
				writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
			}
	  		
	  		echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
		
		 if($ls!="all" && $ls!="all_products")
 {break;}
		
		case "video": //生成视频(Video)
		
			$news_sql3="select * from ls_menu where menuName='video'";
			$news_query3=$opendb->query($news_sql3);
			$news_rows3=mysql_fetch_assoc($news_query3);
			$introduction = $news_rows3['description'];
		
			$news_sql2="select * from ls_video where enable=1 order by Num desc ";
	 		$result=$opendb->query($news_sql2);
			$mynum = mysql_num_rows($result);//总产品数
			// 每页数量
			$onepage = $PageNum; 
			//共有页数
			$allpages = ceil($mynum/$onepage);

			echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			//$propage=getPages("workshop.html",$allpages);

			//根据页码生成文件名
			for ($i=0; $i<= $allpages; $i++){
				$news_sql2="select * from ls_video where enable=1 order by Num desc ";
				if ($i == 0){ 
					$indexpath = "video.html";
		 		}else{ 
					$indexpath = "video".$i.".html";
		 		}
				$start = $i * $onepage;
				
				if($allpages!=1){
					$ls_current_page=$i+1;		//当前页码
				}

		 		//查询产品
				$news_sql2.=" limit ".$start.",".$onepage." ";
				$news_query=$opendb->query($news_sql2);
				$list="<ul class=\"p_list\">";
				
				if("192.168.2.20"==$_SERVER["SERVER_ADDR"] || "pmf.lanscend.cn"==$_SERVER['HTTP_HOST']){
					$url=explode("/", $_SERVER["REQUEST_URI"]);
					$path = "/".$url[1];
				}else{
					$url="";
				}
				while($news_rows=mysql_fetch_assoc($news_query)){
					if($news_rows['code']==NULL){
						$list.="<li><embed src='".$path."/video/".$news_rows['videoFile']."' type='application/x-shockwave-flash' width='".$news_rows['videoW']."' height='".$news_rows['videoH']."' quality='high' />".$news_rows['videoName']."</li>";
					}else{
						$list .= "<li>".$news_rows['code']."<br />".$news_rows['videoName']."</li>";
					}
				}
				$list.="</ul>";
				
				//页码计算
				$propage=getPagess("video.html",$allpages,$ls_current_page);
				
				$index_path="../".$templates_var."/video.html";				//车间模板地址
				$ls_title=$config_rows['companyName'];					//title
				$ls_keywords=$config_rows['siteKeywords'];				//Keywords
				$ls_description=$config_rows['siteDescription'];		//Description
				$ls_cate=$cate;											//左侧产品类别
				$ls_motif=$s_m_cate;
				$ls_menu=$menu;											//主菜单
				$ls_list=$list ;										//车间图片列表
				$ls_introduction=$introduction;                           //车间简介
				$ls_propage=$propage;									//车间分页页码
				$ls_foot=$foot;											//底部信息
				
				$ls_feedbackemail="";
				$mainpart=$ls_list;
				$mainpartsubject="video";
				$filename = "../{$indexpath}";
				writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
			}
	  		
	  		echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
		
		 if($ls!="all" && $ls!="all_products")
 {break;}
		
			case "qualitycontrol": //生成管理团队(Management)
			
			$news_sql3="select * from ls_menu where menuName='Quality'";
			$news_query3=$opendb->query($news_sql3);
			$news_rows3=mysql_fetch_assoc($news_query3);
			$introduction = $news_rows3['description'];
			$introduction =  str_replace("../", "", $introduction);
			
			$news_sql2="select * from ls_qualitycontrol where enable=1 order by Num desc ";
	 		$result=$opendb->query($news_sql2);
			$mynum = mysql_num_rows($result);//总产品数
			// 每页数量
			$onepage = $PageNum; 
			//共有页数
			$allpages = ceil($mynum/$onepage);

			echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			//$propage=getPages("quality.html",$allpages);

			//根据页码生成文件名
			for ($i=0; $i<= $allpages; $i++){ 
				$news_sql2="select * from ls_qualitycontrol where enable=1 order by Num desc ";
				if ($i == 0){ 
					$indexpath = "quality.html";
		 		}else{ 
					$indexpath = "quality-".$i.".html";
		 		}
				$start = $i * $onepage;
				
				if($allpages!=1){
					$ls_current_page=$i+1;		//当前页码
				}
				
		 		//查询产品
				$news_sql2.=" limit ".$start.",".$onepage." ";
				$news_query=$opendb->query($news_sql2);
				$list="<ul class=\"p_list\">";
				while($news_rows=mysql_fetch_assoc($news_query)){
					$list.="
					<li><a href=\"".$QualitycateFolders."/quality-page".$news_rows['ID'].".html\" title=\"{$news_rows['Title']}\">
						<img src=\"".$QualitycateFolders."/".$SmallFoldersProducts."/".$news_rows['Pic']."\" border=\"0\">
						</a><span><a href=\"".$QualitycateFolders."/quality-page".$news_rows['ID'].".html\" title=\"{$news_rows['Title']}\"  class='pn'>".$news_rows['Title']."</a></span></li>";
						
					$newstitle=$news_rows['Title'];
					$newimg = "<center><img src=\"../".$QualitycateFolders."/".$BigFoldersProducts."/".$news_rows['Pic']."\" ondragstart=\"return false;\"/></center>";
					$newstext = $news_rows['Text'];
					$ls_newid = $news_rows['ID'];
					createFolder("../".$WorkShopFolders);
					
					$index_newspath="../".$templates_var."/qualityshow.html";		//模板地址
					if(file_exists($index_newspath)){
						$ls_title=$news_rows['newsTitle'];				//title
						$ls_keywords=$news_rows['newsKeywords'];			//Keywords
						$ls_description=$news_rows['newsDescription'];	//Description
						$ls_cate=$pro_cate;
						$ls_s_cate=$s_pro_cate;								//左侧产品类别;
						$ls_motif=$s_m2_cate;
						$ls_menu=$menu_pro;									//主菜单
						$ls_newstitle=$newstitle ;							//新闻标题
						$ls_newimg=$newimg;
						$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);
						
						$ls_d_cate = str_replace("class=\"dropdown\"","",$ls_s_cate);
						$ls_d_cate = str_replace("class=\"sub-menu\"","",$ls_d_cate);
						
						$newscontent  = str_replace("{ls_d_cate}",$ls_d_cate,$newscontent);
						$newscontent = str_replace("{ls_p_cate}",$ls_p_cate,$newscontent);
						
						$newscontent = str_replace("{ls_s_cate}",$ls_s_cate,$newscontent);
						$newscontent = str_replace("{ls_motif}",$ls_motif,$newscontent);
						$newscontent = str_replace("{ls_propage}",$ls_propage,$newscontent);
						$ls_facebook_twitter = $facebook_twitter;
						$newscontent = str_replace("{ls_weibo}",$ls_facebook_twitter,$newscontent);
						$ls_facebook_twitter_share = $facebook_twitter_share;
						$newscontent = str_replace("{ls_weiboshare}",$ls_facebook_twitter_share,$newscontent);
						
						$ls_indicatebar = "<li><a href=\"../index.html\">Home</a></li>
								   <li><a href=\"../quality.html\">Quality</a></li>";
						$newscontent = str_replace("{ls_indicatebar}",$ls_indicatebar,$newscontent);
						
						$newscontent = str_replace("{ls_newstime}",$ls_newstime,$newscontent);
						$newscontent = str_replace("{ls_newid}",$ls_newid,$newscontent);
						$newscontent = str_replace("{ls_click_n}",$ls_click_n,$newscontent);
						
						$newscontent = str_replace("{ls_newstitle}",$ls_newstitle,$newscontent);
						$newscontent = str_replace("{ls_newimg}",$ls_newimg,$newscontent);
						
						$newscontent = str_replace("{ls_newstext}",$ls_newstext,$newscontent);
						$newscontent = str_replace("{ls_newsdongtai}",$ls_newsdongtai2,$newscontent);		//子目录下新闻
			//new
						$newscontent = str_replace("{ls_newsgonggao}",$ls_newsgonggao2,$newscontent);
						$newscontent = str_replace("{ls_newsall}",$ls_newsall2,$newscontent);
						$newscontent = str_replace("{ls_newstieshi}",$ls_newstieshi2,$newscontent);
						$newscontent = str_replace("{ls_site_cate}",$s_site_cate,$newscontent);
			
						$newscontent = str_replace("{ls_url}",$ls_url,$newscontent);
						$newscontent = str_replace("{ls_foot}",$ls_foot,$newscontent);
						$newscontent = str_replace("{ls_addprolink}",$ls_addprolink,$newscontent);	//指向主菜单中的Products链接
						$newscontent = str_replace("{ls_addnewprolink}",$ls_addnewprolink,$newscontent);	//指向主菜单中的NewProducts链接
						
						$newscontent = circleNavigationLinkNews($news_rows['ID'],'B','{ls_nextlink}',$newscontent,"ls_qualitycontrol",$catenews['cateName'],"quality",$suffix_str2,false);
						$newscontent = circleNavigationLinkNews($news_rows['ID'],'F','{ls_previouslink}',$newscontent,"ls_qualitycontrol",$catenews['cateName'],"quality",$suffix_str2,false);
						
						$newscontent = str_replace("{newstag}",$newstag,$newscontent);
						if($suffix_str == "_dongtai"){
							$newscontent = str_replace("<li id=\"current\"><a href=\"../news.html\">","<li><a href=\"../news.html\">",$newscontent);
							$newscontent = str_replace("<li><a href=\"../technology.html\">","<li id=\"current\"><a href=\"../technology.html\">",$newscontent);
						}
								
						$filename="../".$QualitycateFolders."/quality-page".$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 "'生成文件".$filename."失败！";
						 } 
						fclose ($handle); //关闭指针
						 //echo "创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\"><u>返回</u></a><br/><br/>";
						fclose ($fp);
					}else{
						echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";
					}
				}
				$list.="</ul>";
				
				//页码计算
				$propage=getPagess("quality.html",$allpages,$ls_current_page);
				
				$index_path="../".$templates_var."/quality.html";				//车间模板地址
				$ls_title=$news_rows3['inTitle'];												//title
				$ls_keywords=$news_rows3['inKeywords'];										//Keywords
				$ls_description=$news_rows3['inDescription'];							//Description
				$ls_cate=$cate;											//左侧产品类别
				$ls_motif=$s_m_cate;
				$ls_menu=$menu;											//主菜单
				$ls_list=$list ;										//车间图片列表
				$ls_introduction=$introduction;                           //车间简介
				$ls_propage=$propage;									//车间分页页码
				$ls_foot=$foot;											//底部信息
				
				$ls_feedbackemail="";
				$mainpart=$ls_list;
				$mainpartsubject="qualitycontrol";
				$filename = "../{$indexpath}";
				writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
			}
	  		
	  		echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
		
		 if($ls!="all" && $ls!="all_products")
 {break;}
		
		
	case "rd": //生成研发(R&D)
		
		$news_sql3="select * from ls_menu where menuName='Research&Development'";
		$news_query3=$opendb->query($news_sql3);
		$news_rows3=mysql_fetch_assoc($news_query3);
		$introduction = $news_rows3['description'];
		$introduction =  str_replace("../", "", $introduction);
			
		$news_sql2="select * from ls_rd where enable=1 order by Num desc ";
	  $result=$opendb->query($news_sql2);
		$mynum = mysql_num_rows($result);//总产品数
		// 每页数量
		$onepage = $PageNum; 
		//共有页数
		$allpages = ceil($mynum/$onepage);
		
		//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			$propage=getPages("rd.html",$allpages);
			//页码计算
			
			for ($i=0; $i< $allpages; $i++)
			{ 
			if ($i == 0)
			{ 
			$indexpath = "rd.html";
		  } 
		  else 
		  { 
			$indexpath = "rd".$i.".html";
		  }

		 $start = $i * $onepage;
		 //查询产品
		     $news_sql=$news_sql2." limit ".$start.",".$onepage." ";
			 $news_query=$opendb->query($news_sql);
	         $list="<ul class=\"list\">";
				while($news_rows=mysql_fetch_assoc($news_query)){
					$list.="
					<li><a href=\"".$rdFolders."/".$BigFoldersProducts."/".$news_rows['Pic']."\" target=\"_blank\" title=\"".$news_rows['Text']."\" $('.list').lightBox();>
							<img src=\"".$rdFolders."/".$SmallFoldersProducts."/".$news_rows['Pic']."\" border=\"0\">
							</a><br /><span>".$news_rows['Text']."</span></li>";
							
					$newstitle=$news_rows['Title'];
					$newimg = "<center><img src=\"../".$brandFolders."/".$BigFoldersProducts."/".$news_rows['Pic']."\" ondragstart=\"return false;\"/></center>";
					$newstext = $news_rows['Text'];
					$ls_newid = $news_rows['ID'];
					createFolder("../m/".$brandFolders);
					
					$index_newspath="../".$templates_var."/rdshow.html";		//模板地址
					if(file_exists($index_newspath)){
						$ls_title=$news_rows['newsTitle'];				//title
						$ls_keywords=$news_rows['newsKeywords'];			//Keywords
						$ls_description=$news_rows['newsDescription'];	//Description
						$ls_cate=$pro_cate;
						$ls_s_cate=$s_pro_cate;								//左侧产品类别;
						$ls_motif=$s_m2_cate;
						$ls_menu=$menu_pro;									//主菜单
						$ls_newstitle=$newstitle ;							//新闻标题
						$ls_newimg=$newimg;
						$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_s_cate}",$ls_s_cate,$newscontent);
						$newscontent = str_replace("{ls_p_cate}",$ls_p_cate,$newscontent);
						$newscontent = str_replace("{ls_motif}",$ls_motif,$newscontent);
						$newscontent = str_replace("{ls_propage}",$ls_propage,$newscontent);
						$ls_facebook_twitter = $facebook_twitter;
						$newscontent = str_replace("{ls_weibo}",$ls_facebook_twitter,$newscontent);
						$ls_facebook_twitter_share = $facebook_twitter_share;
						$newscontent = str_replace("{ls_weiboshare}",$ls_facebook_twitter_share,$newscontent);
						
						$newscontent = str_replace("{ls_newstime}",$ls_newstime,$newscontent);
						$newscontent = str_replace("{ls_newid}",$ls_newid,$newscontent);
						$newscontent = str_replace("{ls_click_n}",$ls_click_n,$newscontent);
						
						$newscontent = str_replace("{ls_newstitle}",$ls_newstitle,$newscontent);
						$newscontent = str_replace("{ls_newimg}",$ls_newimg,$newscontent);
						
						$ls_indicatebar = "<li><a href=\"../index.html\">Home</a></li>
								   <li><a href=\"../rd.html\">R&D</a></li>";
						$newscontent = str_replace("{ls_indicatebar}",$ls_indicatebar,$newscontent);
						
						$newscontent = str_replace("{ls_newstext}",$ls_newstext,$newscontent);
						$newscontent = str_replace("{ls_newsdongtai}",$ls_newsdongtai2,$newscontent);		//子目录下新闻
			//new
						$newscontent = str_replace("{ls_newsgonggao}",$ls_newsgonggao2,$newscontent);
						$newscontent = str_replace("{ls_newsall}",$ls_newsall2,$newscontent);
						$newscontent = str_replace("{ls_newstieshi}",$ls_newstieshi2,$newscontent);
						$newscontent = str_replace("{ls_site_cate}",$s_site_cate,$newscontent);
			
						$newscontent = str_replace("{ls_url}",$ls_url,$newscontent);
						$newscontent = str_replace("{ls_foot}",$ls_foot,$newscontent);
						$newscontent = str_replace("{ls_addprolink}",$ls_addprolink,$newscontent);	//指向主菜单中的Products链接
						$newscontent = str_replace("{ls_addnewprolink}",$ls_addnewprolink,$newscontent);	//指向主菜单中的NewProducts链接
						
						$newscontent = circleNavigationLinkNews($news_rows['ID'],'B','{ls_nextlink}',$newscontent,"ls_rd",$catenews['cateName'],"rd",$suffix_str2,false);
						$newscontent = circleNavigationLinkNews($news_rows['ID'],'F','{ls_previouslink}',$newscontent,"ls_rd",$catenews['cateName'],"rd",$suffix_str2,false);
						
						$newscontent = str_replace("{newstag}",$newstag,$newscontent);
						if($suffix_str == "_dongtai"){
							$newscontent = str_replace("<li id=\"current\"><a href=\"../news.html\">","<li><a href=\"../news.html\">",$newscontent);
							$newscontent = str_replace("<li><a href=\"../technology.html\">","<li id=\"current\"><a href=\"../technology.html\">",$newscontent);
						}
								
						$filename="../".$rdFolders."/rd-page".$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 "'生成文件".$filename."失败！";
						 } 
						fclose ($handle); //关闭指针
						 //echo "创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\"><u>返回</u></a><br/><br/>";
						fclose ($fp);
					}else{
						echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";
					}
				}
				$list.="</ul>";
				
				$index_path="../".$templates_var."/rd.html";										//模板地址
				$ls_title=$news_rows3['inTitle'];												//title
				$ls_keywords=$news_rows3['inKeywords'];										//Keywords
				$ls_description=$news_rows3['inDescription'];							//Description
				$ls_cate=$cate;																								//左侧产品类别
				$ls_motif=$s_m_cate;
				$ls_menu=$menu;																								//主菜单
				$ls_list=$list ;																			//新闻news 列表
				$ls_introduction=$introduction;                           //简介
				$ls_propage=$propage;																					//新闻分页页码
				$ls_foot=$foot;																								//底部信息
				
		$ls_feedbackemail="";
		$mainpart=$ls_list;
		$mainpartsubject="rd";
		$filename = "../rd.html"; 
		writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,
$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);

				}
	  		
	  		echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
		
		 if($ls!="all" && $ls!="all_products")
 {break;}
		
	case "certificate": //生成证书(Certificate)
		$news_sql3="select * from ls_menu where menuName='Certificate'";
		$news_query3=$opendb->query($news_sql3);
		$news_rows3=mysql_fetch_assoc($news_query3);
		$introduction = $news_rows3['description'];
		$introduction =  str_replace("../", "", $introduction);
		
		$news_sql2="select * from ls_certificate where enable=1 order by Num desc ";
		$result=$opendb->query($news_sql2);
		$mynum = mysql_num_rows($result);//总产品数
		// 每页数量
		$onepage = $CertificatePageNum; 
		//共有页数
		$allpages = ceil($mynum/$onepage);
		//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
		//页码计算
		//$propage=getPages("certificate.html",$allpages);
		//页码计算
		for ($i=0; $i<= $allpages; $i++){
			$news_sql2="select * from ls_certificate where enable=1 order by Num desc ";
			if ($i == 0){ 
				$indexpath = "certificate.html";
			}else{ 
				$indexpath = "certificate-".$i.".html";
			}
			$start = $i * $onepage;
			
			if($allpages!=1){
					$ls_current_page=$i+1;		//当前页码
			}
			
			//查询产品
			
			$ls_p_cate=$s_p_cate;								//左侧产品类别;
			$ls_f_cate=get_pro_cate(1);	
		 
			$news_sql=$news_sql2." limit ".$start.",".$onepage." ";
			$news_query=$opendb->query($news_sql);
			$list = "<div class=\"row\">";
			while($news_rows=mysql_fetch_assoc($news_query)){
				$list.="<div class=\"col-lg-4 col-md-4 col-sm-6 col-xs-12\">
							<div class=\"thumbnail\">
								<div class=\"img-pic\">
							  <a href=\"".$CertificateFolders."/certificate-page".$news_rows['ID'].".html\"  title=\"".$news_rows['Title']."\" class=\"c-img-height\"><img src=\"".$CertificateFolders."/".$SmallFoldersProducts."/".$news_rows['Pic']."\" alt=\"".$news_rows['Title']."\" /></a>
							  </div>
							  <div class=\"caption pro-name\">
								<h5><a href=\"".$CertificateFolders."/certificate-page".$news_rows['ID'].".html\"  title=\"".$news_rows['Title']."\">".$news_rows['Title']."</a></h5>
							  </div>
							</div>
						  </div>";
					
					$newstitle=$news_rows['Title'];
					$newimg = "<center><img src=\"../".$CertificateFolders."/".$BigFoldersProducts."/".$news_rows['Pic']."\" class=\"img-responsive\"  ondragstart=\"return false;\"/></center>";
					$newstext = $news_rows['Text'];
					$ls_newid = $news_rows['ID'];
					createFolder("../".$WorkShopFolders);
					
					$index_newspath="../".$templates_var."/certificateshow.html";		//模板地址
					if(file_exists($index_newspath)){
						$ls_title=$news_rows['newsTitle'];				//title
						$ls_keywords=$news_rows['newsKeywords'];			//Keywords
						$ls_description=$news_rows['newsDescription'];	//Description
						$ls_cate=$pro_cate;
						$ls_s_cate=$s_pro_cate;								//左侧产品类别;
						$ls_motif=$s_m2_cate;
						$ls_menu=$menu_pro;									//主菜单
						$ls_newstitle=$newstitle ;							//新闻标题
						$ls_newimg=$newimg;
						$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_s_cate}",$ls_s_cate,$newscontent);
						$newscontent = str_replace("{ls_p_cate}",$ls_p_cate,$newscontent);
						$newscontent = str_replace("{ls_f_cate}",$ls_f_cate,$newscontent);
						$ls_d_cate = str_replace("class=\"dropdown\"","",$ls_s_cate);
						$ls_d_cate = str_replace("class=\"sub-menu\"","",$ls_d_cate);
						
						$newscontent  = str_replace("{ls_d_cate}",$ls_d_cate,$newscontent);
						
						$newscontent = str_replace("{ls_motif}",$ls_motif,$newscontent);
						$newscontent = str_replace("{ls_propage}",$ls_propage,$newscontent);
						$ls_facebook_twitter = $facebook_twitter;
						$newscontent = str_replace("{ls_weibo}",$ls_facebook_twitter,$newscontent);
						$ls_facebook_twitter_share = $facebook_twitter_share;
						$newscontent = str_replace("{ls_weiboshare}",$ls_facebook_twitter_share,$newscontent);
						
						$ls_indicatebar = "<li><a href=\"../index.html\">Home</a></li>
								   <li><a href=\"../certificate.html\">Certificate</a></li>";
						$newscontent = str_replace("{ls_indicatebar}",$ls_indicatebar,$newscontent);
						
						$newscontent = str_replace("{ls_newstime}",$ls_newstime,$newscontent);
						$newscontent = str_replace("{ls_newid}",$ls_newid,$newscontent);
						$newscontent = str_replace("{ls_click_n}",$ls_click_n,$newscontent);
						
						$newscontent = str_replace("{ls_newstitle}",$ls_newstitle,$newscontent);
						$newscontent = str_replace("{ls_newimg}",$ls_newimg,$newscontent);
						
						$newscontent = str_replace("{ls_newstext}",$ls_newstext,$newscontent);
						$newscontent = str_replace("{ls_newsdongtai}",$ls_newsdongtai2,$newscontent);		//子目录下新闻
			//new
						$newscontent = str_replace("{ls_newsgonggao}",$ls_newsgonggao2,$newscontent);
						$newscontent = str_replace("{ls_newsall}",$ls_newsall2,$newscontent);
						$newscontent = str_replace("{ls_newstieshi}",$ls_newstieshi2,$newscontent);
						$newscontent = str_replace("{ls_site_cate}",$s_site_cate,$newscontent);
			
						$newscontent = str_replace("{ls_url}",$ls_url,$newscontent);
						$newscontent = str_replace("{ls_foot}",$ls_foot,$newscontent);
						$newscontent = str_replace("{ls_addprolink}",$ls_addprolink,$newscontent);	//指向主菜单中的Products链接
						$newscontent = str_replace("{ls_addnewprolink}",$ls_addnewprolink,$newscontent);	//指向主菜单中的NewProducts链接
						
						$newscontent = circleNavigationLinkNews($news_rows['ID'],'B','{ls_nextlink}',$newscontent,"ls_certificate",$catenews['cateName'],"certificate",$suffix_str2,false);
						$newscontent = circleNavigationLinkNews($news_rows['ID'],'F','{ls_previouslink}',$newscontent,"ls_certificate",$catenews['cateName'],"certificate",$suffix_str2,false);
						
						$newscontent = str_replace("{newstag}",$newstag,$newscontent);
						if($suffix_str == "_dongtai"){
							$newscontent = str_replace("<li id=\"current\"><a href=\"../news.html\">","<li><a href=\"../news.html\">",$newscontent);
							$newscontent = str_replace("<li><a href=\"../technology.html\">","<li id=\"current\"><a href=\"../technology.html\">",$newscontent);
						}
								
						$filename="../".$CertificateFolders."/certificate-page".$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 "'生成文件".$filename."失败！";
						 } 
						fclose ($handle); //关闭指针
						 //echo "创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\"><u>返回</u></a><br/><br/>";
						fclose ($fp);
					}else{
						echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";
					}
			}
			$list.="</div>";
			
			//页码计算
			$propage=getPagess("certificate.html",$allpages,$ls_current_page);
			
			$index_path="../".$templates_var."/certificate.html";//模板地址
			$ls_title=$news_rows3['inTitle'];												//title
			$ls_keywords=$news_rows3['inKeywords'];										//Keywords
			$ls_description=$news_rows3['inDescription'];							//Description
			$ls_cate=$cate;									//左侧产品类别
			$ls_motif=$s_m_cate;
			$ls_menu=$menu;									//主菜单
			$ls_list=$list ;								//新闻news 列表
			$ls_introduction=$introduction;                           //简介
			$ls_propage=$propage;							//新闻分页页码
			$ls_foot=$foot;									//底部信息
			$ls_feedbackemail="";
			$mainpart=$ls_list;
			$mainpartsubject="certificate";
			$filename = "../{$indexpath}";		
			writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
		}
	  	echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
		if($ls!="all" && $ls!="all_products"){break;}
		
		
		case "packing": //生成包装(Packing)
			$news_sql3="select * from ls_menu where menuName='Packing'";
			$news_query3=$opendb->query($news_sql3);
			$news_rows3=mysql_fetch_assoc($news_query3);
			$introduction = $news_rows3['description'];
			$introduction =  str_replace("../", "", $introduction);
		
			$news_sql2="select * from ls_packing where enable=1 order by Num desc ";
	 		$result=$opendb->query($news_sql2);
			$mynum = mysql_num_rows($result);//总产品数
			// 每页数量
			$onepage = $PageNum; 
			//共有页数
			$allpages = ceil($mynum/$onepage);

			echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			//$propage=getPages("packing.html",$allpages);

			//根据页码生成文件名
			for ($i=0; $i<= $allpages; $i++){ 
				$news_sql2="select * from ls_packing where enable=1 order by Num desc ";
				if ($i == 0){ 
					$indexpath = "packing.html";
		 		}else{ 
					$indexpath = "packing-".$i.".html";
		 		}
				$start = $i * $onepage;
				
				if($allpages!=1){
					$ls_current_page=$i+1;		//当前页码
				}
				
				$ls_p_cate=$s_p_cate;								//左侧产品类别;
		 		//查询产品
				$news_sql2.=" limit ".$start.",".$onepage." ";
				$news_query=$opendb->query($news_sql2);
				$list="<div class=\"row pro_list\">";
				while($news_rows=mysql_fetch_assoc($news_query)){
					$list.="<div class=\"col-xs-4\">
							<div class=\"thumbnail\">
								<div class=\"img-pic2\">
							  <a href=\"".$packingFolders."/packing-page".$news_rows['ID'].".html\"  title=\"".$news_rows['Title']."\" class=\"c-img-height\"><img src=\"".$packingFolders."/".$SmallFoldersProducts."/".$news_rows['Pic']."\" alt=\"".$news_rows['Title']."\" /></a>
							  </div>
							  <div class=\"caption pro-name\">
								<a href=\"".$packingFolders."/packing-page".$news_rows['ID'].".html\"  title=\"".$news_rows['Title']."\">".$news_rows['Title']."</a>
							  </div>
							</div>
						  </div>";
					
					$newstitle=$news_rows['Title'];
					$newimg = "<center><img src=\"../".$packingFolders."/".$BigFoldersProducts."/".$news_rows['Pic']."\" class=\"img-responsive\"  ondragstart=\"return false;\"/></center>";
					$newstext = $news_rows['Text'];
					$ls_newid = $news_rows['ID'];
					createFolder("../".$packingFolders);
					
					$index_newspath="../".$templates_var."/packingshow.html";		//模板地址
					if(file_exists($index_newspath)){
						$ls_title=$news_rows['newsTitle'];				//title
						$ls_keywords=$news_rows['newsKeywords'];			//Keywords
						$ls_description=$news_rows['newsDescription'];	//Description
						$ls_cate=$pro_cate;
						$ls_s_cate=$s_pro_cate;								//左侧产品类别;
						$ls_motif=$s_m2_cate;
						$ls_menu=$menu_pro;									//主菜单
						$ls_newstitle=$newstitle ;							//新闻标题
						$ls_newimg=$newimg;
						$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_s_cate}",$ls_s_cate,$newscontent);
						$newscontent = str_replace("{ls_p_cate}",$ls_p_cate,$newscontent);
						$newscontent = str_replace("{ls_motif}",$ls_motif,$newscontent);
						$newscontent = str_replace("{ls_propage}",$ls_propage,$newscontent);
						$ls_facebook_twitter = $facebook_twitter;
						$newscontent = str_replace("{ls_weibo}",$ls_facebook_twitter,$newscontent);
						$ls_facebook_twitter_share = $facebook_twitter_share;
						$newscontent = str_replace("{ls_weiboshare}",$ls_facebook_twitter_share,$newscontent);
						
						$ls_indicatebar = "<li><a href=\"../index.html\">Home</a></li>
								   <li><a href=\"../packing.html\">Packing</a></li>";
						$newscontent = str_replace("{ls_indicatebar}",$ls_indicatebar,$newscontent);
						
						$newscontent = str_replace("{ls_newstime}",$ls_newstime,$newscontent);
						$newscontent = str_replace("{ls_newid}",$ls_newid,$newscontent);
						$newscontent = str_replace("{ls_click_n}",$ls_click_n,$newscontent);
						
						$newscontent = str_replace("{ls_newstitle}",$ls_newstitle,$newscontent);
						$newscontent = str_replace("{ls_newimg}",$ls_newimg,$newscontent);
						
						$newscontent = str_replace("{ls_newstext}",$ls_newstext,$newscontent);
						$newscontent = str_replace("{ls_newsdongtai}",$ls_newsdongtai2,$newscontent);		//子目录下新闻
			//new
						$newscontent = str_replace("{ls_newsgonggao}",$ls_newsgonggao2,$newscontent);
						$newscontent = str_replace("{ls_newsall}",$ls_newsall2,$newscontent);
						$newscontent = str_replace("{ls_newstieshi}",$ls_newstieshi2,$newscontent);
						$newscontent = str_replace("{ls_site_cate}",$s_site_cate,$newscontent);
			
						$newscontent = str_replace("{ls_url}",$ls_url,$newscontent);
						$newscontent = str_replace("{ls_foot}",$ls_foot,$newscontent);
						$newscontent = str_replace("{ls_addprolink}",$ls_addprolink,$newscontent);	//指向主菜单中的Products链接
						$newscontent = str_replace("{ls_addnewprolink}",$ls_addnewprolink,$newscontent);	//指向主菜单中的NewProducts链接
						
						$newscontent = circleNavigationLinkNews($news_rows['ID'],'B','{ls_nextlink}',$newscontent,"ls_packing",$catenews['cateName'],"packing",$suffix_str2,false);
						$newscontent = circleNavigationLinkNews($news_rows['ID'],'F','{ls_previouslink}',$newscontent,"ls_packing",$catenews['cateName'],"packing",$suffix_str2,false);
						
						$newscontent = str_replace("{newstag}",$newstag,$newscontent);
						if($suffix_str == "_dongtai"){
							$newscontent = str_replace("<li id=\"current\"><a href=\"../news.html\">","<li><a href=\"../news.html\">",$newscontent);
							$newscontent = str_replace("<li><a href=\"../technology.html\">","<li id=\"current\"><a href=\"../technology.html\">",$newscontent);
						}
								
						$filename="../".$packingFolders."/packing-page".$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 "'生成文件".$filename."失败！";
						 } 
						fclose ($handle); //关闭指针
						 //echo "创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\"><u>返回</u></a><br/><br/>";
						fclose ($fp);
					}else{
						echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";
					}
				}
				$list.="</div>";
				
				//页码计算
				$propage=getPagess("packing.html",$allpages,$ls_current_page);
				
				$index_path="../".$templates_var."/packing.html";				//车间模板地址
				$ls_title=$news_rows3['inTitle'];												//title
				$ls_keywords=$news_rows3['inKeywords'];										//Keywords
				$ls_description=$news_rows3['inDescription'];							//Description
				$ls_cate=$cate;											//左侧产品类别
				$ls_motif=$s_m_cate;
				$ls_menu=$menu;											//主菜单
				$ls_list=$list ;										//车间图片列表
				$ls_introduction=$introduction;                           //简介
				$ls_propage=$propage;									//车间分页页码
				$ls_foot=$foot;											//底部信息
				
				$ls_feedbackemail="";
				$mainpart=$ls_list;
				$mainpartsubject="packing";
				$filename = "../{$indexpath}";
				writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
			}
	  		
	  		echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
		
		 if($ls!="all" && $ls!="all_products")
 {break;}
		
		
		case "brand": //生成品牌(Brand)
			
		$news_sql3="select * from ls_menu where menuName='brand'";
			$news_query3=$opendb->query($news_sql3);
			mysql_query("set names utf8");
			$news_rows3=mysql_fetch_assoc($news_query3);
			$introduction = $news_rows3['description'];
			$introduction =  str_replace("../", "", $introduction);
		
			$news_sql2="select * from ls_brand where enable=1 order by Num desc ";
	 		$result=$opendb->query($news_sql2);
			mysql_query("set names utf8");
			$mynum = mysql_num_rows($result);//总产品数
			// 每页数量
			$onepage = $brandPageNum; 
			//共有页数
			$allpages = ceil($mynum/$onepage);

			echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			//$propage=getPages("quality.html",$allpages);

			//根据页码生成文件名
			for ($i=0; $i<= $allpages; $i++){
				$news_sql2="select * from ls_brand where enable=1 order by Num desc ";
				if ($i == 0){ 
					$indexpath = "brand.html";
		 		}else{ 
					$indexpath = "brand-".$i.".html";
		 		}
				$start = $i * $onepage;
				
				if($allpages!=1){
					$ls_current_page=$i+1;		//当前页码
				}

		 		//查询产品
				$news_sql2.=" limit ".$start.",".$onepage." ";
				$news_query=$opendb->query($news_sql2);
				mysql_query("set names utf8");
				$list="<ul class=\"p_list\">";
				while($news_rows=mysql_fetch_assoc($news_query)){
					$list.="
					<li><a href=\"".$brandFolders."/brand-page".$news_rows['ID'].".html\" title=\"{$news_rows['Title']}\" $('.p_list').lightBox();>
							<img src=\"".$brandFolders."/".$SmallFoldersProducts."/".$news_rows['Pic']."\" border=\"0\">
							</a><span>".$news_rows['Title']."</span></li>";
							
					$newstitle=$news_rows['Title'];
					$newimg = "<center><img src=\"../".$brandFolders."/".$BigFoldersProducts."/".$news_rows['Pic']."\" ondragstart=\"return false;\"/></center>";
					$newstext = $news_rows['Text'];
					$ls_newid = $news_rows['ID'];
					createFolder("../m/".$brandFolders);
					
					$index_newspath="../".$templates_var."/brandshow.html";		//模板地址
					if(file_exists($index_newspath)){
						$ls_title=$news_rows['newsTitle'];				//title
						$ls_keywords=$news_rows['newsKeywords'];			//Keywords
						$ls_description=$news_rows['newsDescription'];	//Description
						$ls_cate=$pro_cate;
						$ls_s_cate=$s_pro_cate;								//左侧产品类别;
						$ls_motif=$s_m2_cate;
						$ls_menu=$menu_pro;									//主菜单
						$ls_newstitle=$newstitle ;							//新闻标题
						$ls_newimg=$newimg;
						$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_s_cate}",$ls_s_cate,$newscontent);
						$newscontent = str_replace("{ls_p_cate}",$ls_p_cate,$newscontent);
						$newscontent = str_replace("{ls_motif}",$ls_motif,$newscontent);
						$newscontent = str_replace("{ls_propage}",$ls_propage,$newscontent);
						$ls_facebook_twitter = $facebook_twitter;
						$newscontent = str_replace("{ls_weibo}",$ls_facebook_twitter,$newscontent);
						$ls_facebook_twitter_share = $facebook_twitter_share;
						$newscontent = str_replace("{ls_weiboshare}",$ls_facebook_twitter_share,$newscontent);
						
						$ls_indicatebar = "<li><a href=\"../index.html\">Home</a></li>
								   <li><a href=\"../brand.html\">Brand</a></li>";
						$newscontent = str_replace("{ls_indicatebar}",$ls_indicatebar,$newscontent);
						
						$newscontent = str_replace("{ls_newstime}",$ls_newstime,$newscontent);
						$newscontent = str_replace("{ls_newid}",$ls_newid,$newscontent);
						$newscontent = str_replace("{ls_click_n}",$ls_click_n,$newscontent);
						
						$newscontent = str_replace("{ls_newstitle}",$ls_newstitle,$newscontent);
						$newscontent = str_replace("{ls_newimg}",$ls_newimg,$newscontent);
						
						$newscontent = str_replace("{ls_newstext}",$ls_newstext,$newscontent);
						$newscontent = str_replace("{ls_newsdongtai}",$ls_newsdongtai2,$newscontent);		//子目录下新闻
			//new
						$newscontent = str_replace("{ls_newsgonggao}",$ls_newsgonggao2,$newscontent);
						$newscontent = str_replace("{ls_newsall}",$ls_newsall2,$newscontent);
						$newscontent = str_replace("{ls_newstieshi}",$ls_newstieshi2,$newscontent);
						$newscontent = str_replace("{ls_site_cate}",$s_site_cate,$newscontent);
			
						$newscontent = str_replace("{ls_url}",$ls_url,$newscontent);
						$newscontent = str_replace("{ls_foot}",$ls_foot,$newscontent);
						$newscontent = str_replace("{ls_addprolink}",$ls_addprolink,$newscontent);	//指向主菜单中的Products链接
						$newscontent = str_replace("{ls_addnewprolink}",$ls_addnewprolink,$newscontent);	//指向主菜单中的NewProducts链接
						
						$newscontent = circleNavigationLinkNews($news_rows['ID'],'B','{ls_nextlink}',$newscontent,"ls_brand",$catenews['cateName'],"brand",$suffix_str2,false);
						$newscontent = circleNavigationLinkNews($news_rows['ID'],'F','{ls_previouslink}',$newscontent,"ls_brand",$catenews['cateName'],"brand",$suffix_str2,false);
						
						$newscontent = str_replace("{newstag}",$newstag,$newscontent);
						if($suffix_str == "_dongtai"){
							$newscontent = str_replace("<li id=\"current\"><a href=\"../news.html\">","<li><a href=\"../news.html\">",$newscontent);
							$newscontent = str_replace("<li><a href=\"../technology.html\">","<li id=\"current\"><a href=\"../technology.html\">",$newscontent);
						}
								
						$filename="../".$brandFolders."/brand-page".$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 "'生成文件".$filename."失败！";
						 } 
						fclose ($handle); //关闭指针
						 //echo "创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\"><u>返回</u></a><br/><br/>";
						fclose ($fp);
					}else{
						echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";
					}
				}
				$list.="</ul>";
				
				//页码计算
				$propage=getPagess("brand.html",$allpages,$ls_current_page);
				
				$index_path="../".$templates_var."/brand.html";				//车间模板地址
				$ls_title=$news_rows3['inTitle'];												//title
				$ls_keywords=$news_rows3['inKeywords'];										//Keywords
				$ls_description=$news_rows3['inDescription'];							//Description
				$ls_cate=$ls_m_cate;			//左侧产品类别
				$ls_motif=$s_m_cate;
				$ls_menu=$menu;											//主菜单
				$ls_list=$list ;										//车间图片列表
				$ls_introduction=$introduction;                           //车间简介
				$ls_propage=$propage;									//车间分页页码
				$ls_foot=$foot;											//底部信息
				
				$ls_feedbackemail="";
				$mainpart=$ls_list;
				$mainpartsubject="brand";
				$filename = "../{$indexpath}";
				writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
			}
	  		
	  		echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
		
		 if($ls!="all" && $ls!="all_products")
 {break;}

 
//移动终端页面生成
case "all_m":
 
   case "index_m":  //生成 index
   		$index_path="../".$mobi_templates_var."/index.html";	//模板地址
		$ls_title=$config_rows['companyName'];//title
		$ls_keywords=$config_rows['siteKeywords'];	//Keywords
		$ls_description=$config_rows['siteDescription'];//Description
		$ls_cate=$p_m_cate;			//左侧产品类别
		$ls_motif=$s_m_cate;
		$ls_menu=$menu;		//主菜单
		$about_m=mb_substr($inf_row['homeAbout'],0,$lenght_row['code'],'utf-8').((strlen($inf_row['content'])>$lenght_row['code'])?" <a href=\"aboutus.html\">(More...)</a>":"");
		$ls_about=$about_m ;			//globle 首页About us 
		$ls_allabout=$allabout;		//About us
		$ls_foot=$foot;		//底部信息
		
		//首页产品展示 Start
	$products_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 subcateName is null and subcateFolders is null and subcateBrief is null and subcateID is null and AdditionalAttributes&1 and enable=1";
	$products_sql.=" order by No asc limit 0, 9; ";
	$products_query=$opendb->query($products_sql);
	mysql_query("SET NAMES utf8");
	$homepro="";
	$count=1;
	while($products_rows=mysql_fetch_assoc($products_query)){
		if(hassameclass($products_rows['productID'])){
			continue;
		}
		$pro_i++;
		$profile=getproductfolder($products_rows['productID']);
		$prosrc=$profile."/".$SmallFoldersProducts."/".$products_rows['productPic'];
		$prolink=$profile."/".trim(str_replace(substr($products_rows['productPic'],-4),"",$products_rows['productPic'])).".html";
		
		$homepro.="<div class=\"col-xs-4\"><div class=\"thumbnail\"><div class=\"img-pic\"><img src=\"../".$prosrc."\"  border=\"0\" alt=\"".$products_rows['productName']."\" title=\"".$products_rows['productName']."\" ></div><div class=\"caption pro-name\">".$products_rows['productName']."</div>
			</div>
		</div>";
		$count++;
	}

	//首页产品展示 End
		$ls_homepro=$homepro;
		$ls_propage="";
		$mainpart=$allabout;
		$mainpartsubject="index_m";
		$filename="../m/index.html";
		
		writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,
$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);

	 	 if($ls!="all_m" && $ls!="all_products")
 {break;}	


   case "aboutus_m":  //生成 About us
		$index_path="../".$mobi_templates_var."/aboutus.html";	//模板地址
		$ls_title=$config_rows['companyName'];//title
		$ls_keywords=$config_rows['siteKeywords'];	//Keywords
		$ls_description=$config_rows['siteDescription'];//Description
		$ls_cate=$p_m_cate;			//左侧产品类别
		$ls_motif=$s_m_cate;
		$ls_menu=$menu;		//主菜单
		$ls_allabout=$allabout ;		//About us
		$ls_foot=$foot;		//底部信息
		
		$ls_propage="";
		$mainpart=$allabout_m;
		$mainpartsubject="aboutus_m";
		$filename="../m/aboutus.html";
		writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,
$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
		if($ls!="all_m" && $ls!="all_products")
 {break;}	
	
	//case""
	
	 case "technology_m":  //生成 About us
		$index_path="../".$mobi_templates_var."/technology.html";	//模板地址
		$ls_title=$config_rows['companyName'];//title
		$ls_keywords=$config_rows['siteKeywords'];	//Keywords
		$ls_description=$config_rows['siteDescription'];//Description
		$ls_cate=$p_m_cate;			//左侧产品类别
		$ls_motif=$s_m_cate;
		$ls_menu=$menu;		//主菜单
		$ls_allabout=$alltechnology;		//About us
		$ls_foot=$foot;		//底部信息
		
		$ls_propage="";
		$mainpart=$ls_allabout;
		$mainpartsubject="technology";
		$filename="../m/technology.html";
		writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,
$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
		if($ls!="all_m" && $ls!="all_products")
 {break;}	
	
	//case""
	
	case "news_m": //生成手机新闻 News
	
	$news_cate_sql2="select * from `ls_functioncates` where functionName='新闻分类' and enable=1 order by Num asc ";

	$result_cate=$opendb->query($news_cate_sql2);
	$num_cate=mysql_num_rows($result_cate);
	 //$catenews = mysql_fetch_assoc($result_cate);
	$i_news=1;
	// 遍历所有分类 cate, 按分类生成 相关分类的news index.php，如 index_all.html, index_tieshi.html
	// 分页显示，以及全部新闻内容页 newsshow.html
	createFolder("../m/".$newsshowFolders_m);
	$sort='';	
	while($catenews = mysql_fetch_assoc($result_cate))
	{
		 //$mido = "<h3>".$catenews['cateName']."</h3>";
		 $news_sql2="select * from ls_news where enable=1 and cate='".$catenews['cateName']."' order by Num desc ";
 		 $suffix_str2=$catenews['suffStr'];
		 
		 $result=$opendb->query($news_sql2);
		$mynum = mysql_num_rows($result);//总产品数
			// 每页数量
		$onepage = $PageNumNews;
			//共有页数
		$allpages = ceil($mynum/$onepage);
			
		//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
		//页码计算  在ls_syscode里面
		$facebook_twitter = str_replace("YOUR-FACEBOOK",$row['facebook'],$facebook_twitter);
		$facebook_twitter = str_replace("YOUR-TWITTER",$row['twitter'],$facebook_twitter);
		$facebook_twitter = str_replace("YOUR-LINKEDIN",$row['linkedin'],$facebook_twitter);
		$facebook_twitter = str_replace("YOUR-GOOGLE",$row['google'],$facebook_twitter);
		$facebook_twitter = str_replace("YOUR-PINTEREST",$row['pinterest'],$facebook_twitter);
		$facebook_twitter = str_replace("YOUR-YOUTUBE",$row['youtube'],$facebook_twitter);
		
		for ($i=0; $i<= $allpages; $i++){
			$newslist="";
			$suffix_str=$suffix_str2;
			if($i == 0)
			{
				$suffix_str = $suffix_str;
			} 
			else 
			{
				$suffix_str = $suffix_str."-".$i;
			}
			$start = $i * $onepage;
			$propage=getPagess("news".$catenews['suffStr'].".html",$allpages,$i+1);	
			
			//查询产品
			$news_sql=$news_sql2." limit ".$start.",".$onepage." ";

		$mido = "";
		$news_query=$opendb->query($news_sql);
		while($news_rows=mysql_fetch_assoc($news_query))
		{
			$mido.="<li><span>(".$news_rows['newsDate'].")</span><a href=\"".$newsshowFolders_m."/news".$suffix_str2.$news_rows['ID'].".html\">".$news_rows['newsTitle']."</a></li>";
			
			$index_newspath="../".$mobi_templates_var."/newsshow".$suffix_str2.".html";		//模板地址
			if(file_exists($index_newspath)){
				$newstag=$news_rows['cate'];
				$newstitle=$news_rows['newsTitle'];
				$newstext=$news_rows['newsText'];
				$ls_newstime = $news_rows['newsDate'];
				$ls_newid = $news_rows['ID'];
				$ls_click_n = $news_rows['clickNum'];
				createFolder("../".$newsshowFolders);
				
				$index_newspath="../".$mobi_templates_var."/newsshow".$suffix_str2.".html";		//模板地址
				$ls_title = $news_rows['title'];				//title
				$ls_keywords=$news_rows['keywords'];			//Keywords
				$ls_description=$news_rows['description'];	//Description
				$ls_cate=$pro_cate;
				$ls_s_cate=$s_pro_cate;								//左侧产品类别;
				$ls_s_news = $ls_h1_news;
				$ls_p_cate=$s_p_cate;								//左侧产品类别;
				$ls_f_cate=get_pro_cate(1);
				$ls_motif=$s_m2_cate;
				$ls_menu=$menu_pro;									//主菜单
				$ls_newstitle=$newstitle ;							//新闻标题
				$ls_newstext=str_replace("src=\"../", "src=\"../../", $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_s_cate}",$ls_s_cate,$newscontent);
				$newscontent = str_replace("{ls_p_cate}",$ls_p_cate,$newscontent);
				$newscontent = str_replace("{ls_m_cate}",$p_m_cate1,$newscontent);
				$newscontent = str_replace("{ls_f_cate}",$ls_f_cate,$newscontent);
				$newscontent = str_replace("{ls_motif}",$ls_motif,$newscontent);
				$newscontent = str_replace("{ls_propage}",$ls_propage,$newscontent);
				$ls_facebook_twitter = str_replace("../", "../../",$facebook_twitter);
				$newscontent = str_replace("{ls_weibo}",$ls_facebook_twitter,$newscontent);
				$ls_facebook_twitter_share = $facebook_twitter_share;
				$newscontent = str_replace("{ls_weiboshare}",$ls_facebook_twitter_share,$newscontent);
				
				$ls_indicatebar = "<li><a href=\"../index.html\">Home</a></li>
								   <li style='text-transform : capitalize;'><a href=\"../news".$suffix_str2.".html\">".$suffix_str2."</a></li>";
				$newscontent = str_replace("{ls_indicatebar}",$ls_indicatebar,$newscontent);
				
				$newscontent = str_replace("{ls_news}",$ls_s_news,$newscontent);
				
				$newscontent = str_replace("{ls_newstime}",$ls_newstime,$newscontent);
				$newscontent = str_replace("{ls_newid}",$ls_newid,$newscontent);
				$newscontent = str_replace("{ls_click_n}",$ls_click_n,$newscontent);
				
				$newscontent = str_replace("{ls_newstitle}",$ls_newstitle,$newscontent);
				$newscontent = str_replace("{ls_newstext}",$ls_newstext,$newscontent);
				$newscontent = str_replace("{ls_newsdongtai}",$ls_newsdongtai2,$newscontent);		//子目录下新闻
	//new
				$newscontent = str_replace("{ls_newsgonggao}",$ls_newsgonggao2,$newscontent);
				$newscontent = str_replace("{ls_newsall}",$ls_newsall2,$newscontent);
				$newscontent = str_replace("{ls_newstieshi}",$ls_newstieshi2,$newscontent);
				$newscontent = str_replace("{ls_site_cate}",$s_site_cate,$newscontent);
	
				$newscontent = str_replace("{ls_url}",$ls_url,$newscontent);
				$newscontent = str_replace("{ls_foot}",$ls_foot,$newscontent);
				$newscontent = str_replace("{ls_addprolink}",$ls_addprolink,$newscontent);	//指向主菜单中的Products链接
				$newscontent = str_replace("{ls_addnewprolink}",$ls_addnewprolink,$newscontent);	//指向主菜单中的NewProducts链接
				
				$newscontent = circleNavigationLinkNews($news_rows['ID'],'F','{ls_nextlink}',$newscontent,"ls_news",$catenews['cateName'],"news",$suffix_str2,true);
				$newscontent = circleNavigationLinkNews($news_rows['ID'],'B','{ls_previouslink}',$newscontent,"ls_news",$catenews['cateName'],"news",$suffix_str2,true);
				
				$newscontent = str_replace("{newstag}",$newstag,$newscontent);
				if($suffix_str == "_dongtai"){
					$newscontent = str_replace("<li id=\"current\"><a href=\"../news.html\">","<li><a href=\"../news.html\">",$newscontent);
					$newscontent = str_replace("<li><a href=\"../technology.html\">","<li id=\"current\"><a href=\"../technology.html\">",$newscontent);
				}
						
				$filename="../m/".$newsshowFolders_m."/news".$cate_rows["cate"].$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 "'生成文件".$filename."失败！";
				 } 
				fclose ($handle); //关闭指针
				echo "创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\"><u>返回</u></a><br/><br/>";
				fclose ($fp);
			}else{
				echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";	
			}
					
		}
		
	//end for , all pages
	
$index_path="../".$mobi_templates_var."/news".$suffix_str2.".html";												  //模板地址
		$ls_title=$config_rows['companyName'];												//title
		$ls_keywords=$config_rows['siteKeywords'];										//Keywords
		$ls_description=$config_rows['siteDescription'];							//Description
		$ls_cate=$cate;																								//左侧产品类别
		$ls_motif=$s_m_cate;
		$ls_menu=$menu;																								//主菜单
		$ls_newslist=$mido ;																			//新闻news 列表
		$ls_propage=$propage;																					//新闻分页页码
		$ls_foot=$foot;																								//底部信息
		
		$ls_feedbackemail="";
		$mainpart=$ls_newslist;
		$mainpartsubject="news_m";
		$filename = "../m/news".$suffix_str.".html";
		writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,
$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
	}//end of while all news cats
}
		echo "共有".$mynum."条新闻。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
	 if($ls!="all_m" && $ls!="all_products")
 {break;}
 
 case "workshop_m": //生成工厂(workshop)
			$news_sql3="select * from ls_menu where menuName='Workshop'";
			$news_query3=$opendb->query($news_sql3);
			$news_rows3=mysql_fetch_assoc($news_query3);
			$introduction = $news_rows3['description'];
		
			$news_sql2="select * from ls_workshop where enable=1 order by Num ";
	 		$result=$opendb->query($news_sql2);
			$mynum = mysql_num_rows($result);//总产品数
			// 每页数量
			$onepage = $PageNum; 
			//共有页数
			$allpages = ceil($mynum/$onepage);

			echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			//$propage=getPages("workshop.html",$allpages);
			
			$facebook_twitter = str_replace("YOUR-FACEBOOK",$row['facebook'],$facebook_twitter);
			$facebook_twitter = str_replace("YOUR-TWITTER",$row['twitter'],$facebook_twitter);
			$facebook_twitter = str_replace("YOUR-LINKEDIN",$row['linkedin'],$facebook_twitter);
			$facebook_twitter = str_replace("YOUR-GOOGLE",$row['google'],$facebook_twitter);
			$facebook_twitter = str_replace("YOUR-PINTEREST",$row['pinterest'],$facebook_twitter);
			$facebook_twitter = str_replace("YOUR-YOUTUBE",$row['youtube'],$facebook_twitter);

			//根据页码生成文件名
			for ($i=0; $i<= $allpages; $i++){ 
				$news_sql2="select * from ls_workshop where enable=1 order by Num ";
				if ($i == 0){ 
					$indexpath = "workshop.html";
		 		}else{ 
					$indexpath = "workshop-".$i.".html";
		 		}
				$start = $i * $onepage;
				
				if($allpages!=1){
					$ls_current_page=$i+1;		//当前页码
				}
				
				$ls_p_cate=$s_p_cate;	//左侧产品类别;
		 		//查询产品
				$news_sql2.=" limit ".$start.",".$onepage." ";
				$news_query=$opendb->query($news_sql2);
				$list="<div class=\"row pro_list masonry-container\">";
				while($news_rows=mysql_fetch_assoc($news_query)){
					$list.="<div class=\"col-xs-4 item\">
							<div class=\"thumbnail\">
								<div class=\"img-pic2\">
							  <a href=\"".$WorkShopFolders."/workshop-page".$news_rows['ID'].".html\"  title=\"".$news_rows['Title']."\" class=\"c-img\"><img src=\"../".$WorkShopFolders."/".$SmallFoldersProducts."/".$news_rows['workshopPic']."\" alt=\"".$news_rows['Title']."\" /></a>
							  </div>
							  <div class=\"caption pro-name\">
								<a href=\"".$WorkShopFolders."/workshop-page".$news_rows['ID'].".html\"  title=\"".$news_rows['Title']."\">".$news_rows['Title']."</a>
							  </div>
							</div>
						  </div>";
					
					$newstitle=$news_rows['Title'];
					$newimg = "<center><img src=\"../../".$WorkShopFolders."/".$BigFoldersProducts."/".$news_rows['workshopPic']."\" class=\"img-responsive\"  ondragstart=\"return false;\"/></center>";
					$newstext = str_replace("src=\"../", "src=\"../../", $news_rows['workshopText']);
					$ls_newid = $news_rows['ID'];
					createFolder("../m/".$WorkShopFolders);
					
					$index_newspath="../".$mobi_templates_var."/workshopshow.html";		//模板地址
					if(file_exists($index_newspath)){
						$ls_title=$news_rows['newsTitle'];				//title
						$ls_keywords=$news_rows['newsKeywords'];			//Keywords
						$ls_description=$news_rows['newsDescription'];	//Description
						$ls_cate=$pro_cate;
						$ls_s_cate=$s_pro_cate;								//左侧产品类别;
						$ls_motif=$s_m2_cate;
						$ls_menu=$menu_pro;									//主菜单
						$ls_newstitle=$newstitle ;							//新闻标题
						$ls_newimg=$newimg;
						$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_s_cate}",$ls_s_cate,$newscontent);
						$newscontent = str_replace("{ls_p_cate}",$ls_p_cate,$newscontent);
						$newscontent = str_replace("{ls_m_cate}",$p_m_cate1,$newscontent);
						$newscontent = str_replace("{ls_motif}",$ls_motif,$newscontent);
						$newscontent = str_replace("{ls_propage}",$ls_propage,$newscontent);
						$ls_facebook_twitter = str_replace("../", "../../",$facebook_twitter);
						$newscontent = str_replace("{ls_weibo}",$ls_facebook_twitter,$newscontent);
						$ls_facebook_twitter_share = $facebook_twitter_share;
						$newscontent = str_replace("{ls_weiboshare}",$ls_facebook_twitter_share,$newscontent);
						
						$ls_indicatebar = "<li><a href=\"../index.html\">Home</a></li>
								   <li><a href=\"../workshop.html\">workshop</a></li>";
						$newscontent = str_replace("{ls_indicatebar}",$ls_indicatebar,$newscontent);
						
						$newscontent = str_replace("{ls_newstime}",$ls_newstime,$newscontent);
						$newscontent = str_replace("{ls_newid}",$ls_newid,$newscontent);
						$newscontent = str_replace("{ls_click_n}",$ls_click_n,$newscontent);
						
						$newscontent = str_replace("{ls_newstitle}",$ls_newstitle,$newscontent);
						$newscontent = str_replace("{ls_newimg}",$ls_newimg,$newscontent);
						
						$newscontent = str_replace("{ls_newstext}",$ls_newstext,$newscontent);
						$newscontent = str_replace("{ls_newsdongtai}",$ls_newsdongtai2,$newscontent);		//子目录下新闻
			//new
						$newscontent = str_replace("{ls_newsgonggao}",$ls_newsgonggao2,$newscontent);
						$newscontent = str_replace("{ls_newsall}",$ls_newsall2,$newscontent);
						$newscontent = str_replace("{ls_newstieshi}",$ls_newstieshi2,$newscontent);
						$newscontent = str_replace("{ls_site_cate}",$s_site_cate,$newscontent);
			
						$newscontent = str_replace("{ls_url}",$ls_url,$newscontent);
						$newscontent = str_replace("{ls_foot}",$ls_foot,$newscontent);
						$newscontent = str_replace("{ls_addprolink}",$ls_addprolink,$newscontent);	//指向主菜单中的Products链接
						$newscontent = str_replace("{ls_addnewprolink}",$ls_addnewprolink,$newscontent);	//指向主菜单中的NewProducts链接
						
						$newscontent = circleNavigationLinkNews($news_rows['ID'],'B','{ls_nextlink}',$newscontent,"ls_workshop",$catenews['cateName'],"workshop",$suffix_str2,false);
						$newscontent = circleNavigationLinkNews($news_rows['ID'],'F','{ls_previouslink}',$newscontent,"ls_workshop",$catenews['cateName'],"workshop",$suffix_str2,false);
						
						$newscontent = str_replace("{newstag}",$newstag,$newscontent);
						if($suffix_str == "_dongtai"){
							$newscontent = str_replace("<li id=\"current\"><a href=\"../news.html\">","<li><a href=\"../news.html\">",$newscontent);
							$newscontent = str_replace("<li><a href=\"../technology.html\">","<li id=\"current\"><a href=\"../technology.html\">",$newscontent);
						}
								
						$filename="../m/".$WorkShopFolders."/workshop-page".$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 "'生成文件".$filename."失败！";
						 } 
						fclose ($handle); //关闭指针
						 //echo "创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\"><u>返回</u></a><br/><br/>";
						fclose ($fp);
					}else{
						echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";
					}
				}
				$list.="</div>";
				
				//页码计算
				$propage=getPagess("workshop.html",$allpages,$ls_current_page);
				
				$index_path="../".$mobi_templates_var."/workshop.html";				//车间模板地址
				$ls_title=$news_rows3['inTitle'];												//title
				$ls_keywords=$news_rows3['inKeywords'];										//Keywords
				$ls_description=$news_rows3['inDescription'];							//Description
				$ls_cate=$cate;											//左侧产品类别
				$ls_motif=$s_m_cate;
				$ls_menu=$menu;											//主菜单
				$ls_list=$list ;										//车间图片列表
				$ls_introduction=$introduction;                           //简介
				$ls_propage=$propage;									//车间分页页码
				$ls_foot=$foot;											//底部信息
				
				$ls_feedbackemail="";
				$mainpart=$ls_list;
				$mainpartsubject="workshop_m";
				$filename = "../m/{$indexpath}";
				writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
			}
	  		
	  		echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
		
		 if($ls!="all_m" && $ls!="all_products")
 {break;}
 
 case "certificate_m": //生成包装(Packing)
			$news_sql3="select * from ls_menu where menuName='Certificate'";
			$news_query3=$opendb->query($news_sql3);
			$news_rows3=mysql_fetch_assoc($news_query3);
			$introduction = $news_rows3['description'];
		
			$news_sql2="select * from ls_certificate where enable=1 order by Num ";
	 		$result=$opendb->query($news_sql2);
			$mynum = mysql_num_rows($result);//总产品数
			// 每页数量
			$onepage = $PageNum; 
			//共有页数
			$allpages = ceil($mynum/$onepage);

			echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			//$propage=getPages("certificate.html",$allpages);
			
			$facebook_twitter = str_replace("YOUR-FACEBOOK",$row['facebook'],$facebook_twitter);
			$facebook_twitter = str_replace("YOUR-TWITTER",$row['twitter'],$facebook_twitter);
			$facebook_twitter = str_replace("YOUR-LINKEDIN",$row['linkedin'],$facebook_twitter);
			$facebook_twitter = str_replace("YOUR-GOOGLE",$row['google'],$facebook_twitter);
			$facebook_twitter = str_replace("YOUR-PINTEREST",$row['pinterest'],$facebook_twitter);
			$facebook_twitter = str_replace("YOUR-YOUTUBE",$row['youtube'],$facebook_twitter);

			//根据页码生成文件名
			for ($i=0; $i<= $allpages; $i++){ 
				$news_sql2="select * from ls_certificate where enable=1 order by Num ";
				if ($i == 0){ 
					$indexpath = "certificate.html";
		 		}else{ 
					$indexpath = "certificate-".$i.".html";
		 		}
				$start = $i * $onepage;
				
				if($allpages!=1){
					$ls_current_page=$i+1;		//当前页码
				}
				
				$ls_p_cate=$s_p_cate;	//左侧产品类别;
		 		//查询产品
				$news_sql2.=" limit ".$start.",".$onepage." ";
				$news_query=$opendb->query($news_sql2);
				$list="<div class=\"row pro_list masonry-container\">";
				while($news_rows=mysql_fetch_assoc($news_query)){
					$list.="<div class=\"col-xs-4 item\">
							<div class=\"thumbnail\">
								<div class=\"img-pic2\">
							  <a href=\"".$CertificateFolders."/certificate-page".$news_rows['ID'].".html\"  title=\"".$news_rows['Title']."\" class=\"c-img\"><img src=\"../".$CertificateFolders."/".$SmallFoldersProducts."/".$news_rows['Pic']."\" alt=\"".$news_rows['Title']."\" /></a>
							  </div>
							  <div class=\"caption pro-name\">
								<a href=\"".$CertificateFolders."/certificate-page".$news_rows['ID'].".html\"  title=\"".$news_rows['Title']."\">".$news_rows['Title']."</a>
							  </div>
							</div>
						  </div>";
					
					$newstitle=$news_rows['Title'];
					$newimg = "<center><img src=\"../../".$CertificateFolders."/".$BigFoldersProducts."/".$news_rows['Pic']."\" class=\"img-responsive\"  ondragstart=\"return false;\"/></center>";
					$newstext = str_replace("src=\"../", "src=\"../../", $news_rows['Text']);
					$ls_newid = $news_rows['ID'];
					createFolder("../m/".$CertificateFolders);
					
					$index_newspath="../".$mobi_templates_var."/certificateshow.html";		//模板地址
					if(file_exists($index_newspath)){
						$ls_title=$news_rows['newsTitle'];				//title
						$ls_keywords=$news_rows['newsKeywords'];			//Keywords
						$ls_description=$news_rows['newsDescription'];	//Description
						$ls_cate=$pro_cate;
						$ls_s_cate=$s_pro_cate;								//左侧产品类别;
						$ls_motif=$s_m2_cate;
						$ls_menu=$menu_pro;									//主菜单
						$ls_newstitle=$newstitle ;							//新闻标题
						$ls_newimg=$newimg;
						$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_s_cate}",$ls_s_cate,$newscontent);
						$newscontent = str_replace("{ls_p_cate}",$ls_p_cate,$newscontent);
						$newscontent = str_replace("{ls_m_cate}",$p_m_cate1,$newscontent);
						$newscontent = str_replace("{ls_motif}",$ls_motif,$newscontent);
						$newscontent = str_replace("{ls_propage}",$ls_propage,$newscontent);
						$ls_facebook_twitter = str_replace("../", "../../",$facebook_twitter);
						$newscontent = str_replace("{ls_weibo}",$ls_facebook_twitter,$newscontent);
						$ls_facebook_twitter_share = $facebook_twitter_share;
						$newscontent = str_replace("{ls_weiboshare}",$ls_facebook_twitter_share,$newscontent);
						
						$ls_indicatebar = "<li><a href=\"../index.html\">Home</a></li>
								   <li><a href=\"../certificate.html\">certificate</a></li>";
						$newscontent = str_replace("{ls_indicatebar}",$ls_indicatebar,$newscontent);
						
						$newscontent = str_replace("{ls_newstime}",$ls_newstime,$newscontent);
						$newscontent = str_replace("{ls_newid}",$ls_newid,$newscontent);
						$newscontent = str_replace("{ls_click_n}",$ls_click_n,$newscontent);
						
						$newscontent = str_replace("{ls_newstitle}",$ls_newstitle,$newscontent);
						$newscontent = str_replace("{ls_newimg}",$ls_newimg,$newscontent);
						
						$newscontent = str_replace("{ls_newstext}",$ls_newstext,$newscontent);
						$newscontent = str_replace("{ls_newsdongtai}",$ls_newsdongtai2,$newscontent);		//子目录下新闻
			//new
						$newscontent = str_replace("{ls_newsgonggao}",$ls_newsgonggao2,$newscontent);
						$newscontent = str_replace("{ls_newsall}",$ls_newsall2,$newscontent);
						$newscontent = str_replace("{ls_newstieshi}",$ls_newstieshi2,$newscontent);
						$newscontent = str_replace("{ls_site_cate}",$s_site_cate,$newscontent);
			
						$newscontent = str_replace("{ls_url}",$ls_url,$newscontent);
						$newscontent = str_replace("{ls_foot}",$ls_foot,$newscontent);
						$newscontent = str_replace("{ls_addprolink}",$ls_addprolink,$newscontent);	//指向主菜单中的Products链接
						$newscontent = str_replace("{ls_addnewprolink}",$ls_addnewprolink,$newscontent);	//指向主菜单中的NewProducts链接
						
						$newscontent = circleNavigationLinkNews($news_rows['ID'],'B','{ls_nextlink}',$newscontent,"ls_certificate",$catenews['cateName'],"certificate",$suffix_str2,false);
						$newscontent = circleNavigationLinkNews($news_rows['ID'],'F','{ls_previouslink}',$newscontent,"ls_certificate",$catenews['cateName'],"certificate",$suffix_str2,false);
						
						$newscontent = str_replace("{newstag}",$newstag,$newscontent);
						if($suffix_str == "_dongtai"){
							$newscontent = str_replace("<li id=\"current\"><a href=\"../news.html\">","<li><a href=\"../news.html\">",$newscontent);
							$newscontent = str_replace("<li><a href=\"../technology.html\">","<li id=\"current\"><a href=\"../technology.html\">",$newscontent);
						}
								
						$filename="../m/".$CertificateFolders."/certificate-page".$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 "'生成文件".$filename."失败！";
						 } 
						fclose ($handle); //关闭指针
						 //echo "创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\"><u>返回</u></a><br/><br/>";
						fclose ($fp);
					}else{
						echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";
					}
				}
				$list.="</div>";
				
				//页码计算
				$propage=getPagess("certificate.html",$allpages,$ls_current_page);
				
				$index_path="../".$mobi_templates_var."/certificate.html";				//车间模板地址
				$ls_title=$news_rows3['inTitle'];												//title
				$ls_keywords=$news_rows3['inKeywords'];										//Keywords
				$ls_description=$news_rows3['inDescription'];							//Description
				$ls_cate=$cate;											//左侧产品类别
				$ls_motif=$s_m_cate;
				$ls_menu=$menu;											//主菜单
				$ls_list=$list ;										//车间图片列表
				$ls_introduction=$introduction;                           //简介
				$ls_propage=$propage;									//车间分页页码
				$ls_foot=$foot;											//底部信息
				
				$ls_feedbackemail="";
				$mainpart=$ls_list;
				$mainpartsubject="certificate_m";
				$filename = "../m/{$indexpath}";
				writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
			}
	  		
	  		echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
		
		 if($ls!="all_m" && $ls!="all_products")
 {break;}
 
 case "qualitycontrol_m": //生成质量(Quality)
			$news_sql3="select * from ls_menu where menuName='Quality'";
			$news_query3=$opendb->query($news_sql3);
			$news_rows3=mysql_fetch_assoc($news_query3);
			$introduction = $news_rows3['description'];
		
			$news_sql2="select * from ls_qualitycontrol where enable=1 order by Num ";
	 		$result=$opendb->query($news_sql2);
			$mynum = mysql_num_rows($result);//总产品数
			// 每页数量
			$onepage = $PageNum; 
			//共有页数
			$allpages = ceil($mynum/$onepage);

			echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			//$propage=getPages("quality.html",$allpages);
			
			$facebook_twitter = str_replace("YOUR-FACEBOOK",$row['facebook'],$facebook_twitter);
			$facebook_twitter = str_replace("YOUR-TWITTER",$row['twitter'],$facebook_twitter);
			$facebook_twitter = str_replace("YOUR-LINKEDIN",$row['linkedin'],$facebook_twitter);
			$facebook_twitter = str_replace("YOUR-GOOGLE",$row['google'],$facebook_twitter);
			$facebook_twitter = str_replace("YOUR-PINTEREST",$row['pinterest'],$facebook_twitter);
			$facebook_twitter = str_replace("YOUR-YOUTUBE",$row['youtube'],$facebook_twitter);

			//根据页码生成文件名
			for ($i=0; $i<= $allpages; $i++){ 
				$news_sql2="select * from ls_qualitycontrol where enable=1 order by Num ";
				if ($i == 0){ 
					$indexpath = "quality.html";
		 		}else{ 
					$indexpath = "quality-".$i.".html";
		 		}
				$start = $i * $onepage;
				
				if($allpages!=1){
					$ls_current_page=$i+1;		//当前页码
				}
				
				$ls_p_cate=$s_p_cate;	//左侧产品类别;
		 		//查询产品
				$news_sql2.=" limit ".$start.",".$onepage." ";
				$news_query=$opendb->query($news_sql2);
				$list="<div class=\"row pro_list masonry-container\">";
				while($news_rows=mysql_fetch_assoc($news_query)){
					$list.="<div class=\"col-xs-4 item\">
							<div class=\"thumbnail\">
								<div class=\"img-pic2\">
							  <a href=\"".$qualitycontrolFolders."/quality-page".$news_rows['ID'].".html\"  title=\"".$news_rows['Title']."\" class=\"c-img\"><img src=\"../".$qualitycontrolFolders."/".$SmallFoldersProducts."/".$news_rows['Pic']."\" alt=\"".$news_rows['Title']."\" /></a>
							  </div>
							  <div class=\"caption pro-name\">
								<a href=\"".$qualitycontrolFolders."/quality-page".$news_rows['ID'].".html\"  title=\"".$news_rows['Title']."\">".$news_rows['Title']."</a>
							  </div>
							</div>
						  </div>";
					
					$newstitle=$news_rows['Title'];
					$newimg = "<center><img src=\"../../".$qualitycontrolFolders."/".$BigFoldersProducts."/".$news_rows['Pic']."\" class=\"img-responsive\"  ondragstart=\"return false;\"/></center>";
					$newstext = str_replace("src=\"../", "src=\"../../", $news_rows['Text']);
					$ls_newid = $news_rows['ID'];
					createFolder("../m/".$qualitycontrolFolders);
					
					$index_newspath="../".$mobi_templates_var."/qualityshow.html";		//模板地址
					if(file_exists($index_newspath)){
						$ls_title=$news_rows['newsTitle'];				//title
						$ls_keywords=$news_rows['newsKeywords'];			//Keywords
						$ls_description=$news_rows['newsDescription'];	//Description
						$ls_cate=$pro_cate;
						$ls_s_cate=$s_pro_cate;								//左侧产品类别;
						$ls_motif=$s_m2_cate;
						$ls_menu=$menu_pro;									//主菜单
						$ls_newstitle=$newstitle ;							//新闻标题
						$ls_newimg=$newimg;
						$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_s_cate}",$ls_s_cate,$newscontent);
						$newscontent = str_replace("{ls_p_cate}",$ls_p_cate,$newscontent);
						$newscontent = str_replace("{ls_m_cate}",$p_m_cate1,$newscontent);
						$newscontent = str_replace("{ls_motif}",$ls_motif,$newscontent);
						$newscontent = str_replace("{ls_propage}",$ls_propage,$newscontent);
						$ls_facebook_twitter = str_replace("../", "../../",$facebook_twitter);
						$newscontent = str_replace("{ls_weibo}",$ls_facebook_twitter,$newscontent);
						$ls_facebook_twitter_share = $facebook_twitter_share;
						$newscontent = str_replace("{ls_weiboshare}",$ls_facebook_twitter_share,$newscontent);
						
						$ls_indicatebar = "<li><a href=\"../index.html\">Home</a></li>
								   <li><a href=\"../quality.html\">quality</a></li>";
						$newscontent = str_replace("{ls_indicatebar}",$ls_indicatebar,$newscontent);
						
						$newscontent = str_replace("{ls_newstime}",$ls_newstime,$newscontent);
						$newscontent = str_replace("{ls_newid}",$ls_newid,$newscontent);
						$newscontent = str_replace("{ls_click_n}",$ls_click_n,$newscontent);
						
						$newscontent = str_replace("{ls_newstitle}",$ls_newstitle,$newscontent);
						$newscontent = str_replace("{ls_newimg}",$ls_newimg,$newscontent);
						
						$newscontent = str_replace("{ls_newstext}",$ls_newstext,$newscontent);
						$newscontent = str_replace("{ls_newsdongtai}",$ls_newsdongtai2,$newscontent);		//子目录下新闻
			//new
						$newscontent = str_replace("{ls_newsgonggao}",$ls_newsgonggao2,$newscontent);
						$newscontent = str_replace("{ls_newsall}",$ls_newsall2,$newscontent);
						$newscontent = str_replace("{ls_newstieshi}",$ls_newstieshi2,$newscontent);
						$newscontent = str_replace("{ls_site_cate}",$s_site_cate,$newscontent);
			
						$newscontent = str_replace("{ls_url}",$ls_url,$newscontent);
						$newscontent = str_replace("{ls_foot}",$ls_foot,$newscontent);
						$newscontent = str_replace("{ls_addprolink}",$ls_addprolink,$newscontent);	//指向主菜单中的Products链接
						$newscontent = str_replace("{ls_addnewprolink}",$ls_addnewprolink,$newscontent);	//指向主菜单中的NewProducts链接
						
						$newscontent = circleNavigationLinkNews($news_rows['ID'],'B','{ls_nextlink}',$newscontent,"ls_qualitycontrol",$catenews['cateName'],"quality",$suffix_str2,false);
						$newscontent = circleNavigationLinkNews($news_rows['ID'],'F','{ls_previouslink}',$newscontent,"ls_qualitycontrol",$catenews['cateName'],"quality",$suffix_str2,false);
						
						$newscontent = str_replace("{newstag}",$newstag,$newscontent);
						if($suffix_str == "_dongtai"){
							$newscontent = str_replace("<li id=\"current\"><a href=\"../news.html\">","<li><a href=\"../news.html\">",$newscontent);
							$newscontent = str_replace("<li><a href=\"../technology.html\">","<li id=\"current\"><a href=\"../technology.html\">",$newscontent);
						}
								
						$filename="../m/".$qualitycontrolFolders."/quality-page".$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 "'生成文件".$filename."失败！";
						 } 
						fclose ($handle); //关闭指针
						 //echo "创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\"><u>返回</u></a><br/><br/>";
						fclose ($fp);
					}else{
						echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";
					}
				}
				$list.="</div>";
				
				//页码计算
				$propage=getPagess("quality.html",$allpages,$ls_current_page);
				
				$index_path="../".$mobi_templates_var."/quality.html";				//车间模板地址
				$ls_title=$news_rows3['inTitle'];												//title
				$ls_keywords=$news_rows3['inKeywords'];										//Keywords
				$ls_description=$news_rows3['inDescription'];							//Description
				$ls_cate=$cate;											//左侧产品类别
				$ls_motif=$s_m_cate;
				$ls_menu=$menu;											//主菜单
				$ls_list=$list ;										//车间图片列表
				$ls_introduction=$introduction;                           //简介
				$ls_propage=$propage;									//车间分页页码
				$ls_foot=$foot;											//底部信息
				
				$ls_feedbackemail="";
				$mainpart=$ls_list;
				$mainpartsubject="quality_m";
				$filename = "../m/{$indexpath}";
				writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
			}
	  		
	  		echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
		
		 if($ls!="all_m" && $ls!="all_products")
 {break;}
 
 case "packing_m": //生成包装(Packing)
			$news_sql3="select * from ls_menu where menuName='Packing'";
			$news_query3=$opendb->query($news_sql3);
			$news_rows3=mysql_fetch_assoc($news_query3);
			$introduction = $news_rows3['description'];
		
			$news_sql2="select * from ls_packing where enable=1 order by Num ";
	 		$result=$opendb->query($news_sql2);
			$mynum = mysql_num_rows($result);//总产品数
			// 每页数量
			$onepage = $PageNum; 
			//共有页数
			$allpages = ceil($mynum/$onepage);

			echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			//$propage=getPages("packing.html",$allpages);
			
			$facebook_twitter = str_replace("YOUR-FACEBOOK",$row['facebook'],$facebook_twitter);
			$facebook_twitter = str_replace("YOUR-TWITTER",$row['twitter'],$facebook_twitter);
			$facebook_twitter = str_replace("YOUR-LINKEDIN",$row['linkedin'],$facebook_twitter);
			$facebook_twitter = str_replace("YOUR-GOOGLE",$row['google'],$facebook_twitter);
			$facebook_twitter = str_replace("YOUR-PINTEREST",$row['pinterest'],$facebook_twitter);
			$facebook_twitter = str_replace("YOUR-YOUTUBE",$row['youtube'],$facebook_twitter);

			//根据页码生成文件名
			for ($i=0; $i<= $allpages; $i++){ 
				$news_sql2="select * from ls_packing where enable=1 order by Num ";
				if ($i == 0){ 
					$indexpath = "packing.html";
		 		}else{ 
					$indexpath = "packing-".$i.".html";
		 		}
				$start = $i * $onepage;
				
				if($allpages!=1){
					$ls_current_page=$i+1;		//当前页码
				}
				
				$ls_p_cate=$s_p_cate;	//左侧产品类别;
		 		//查询产品
				$news_sql2.=" limit ".$start.",".$onepage." ";
				$news_query=$opendb->query($news_sql2);
				$list="<div class=\"row pro_list masonry-container\">";
				while($news_rows=mysql_fetch_assoc($news_query)){
					$list.="<div class=\"col-xs-4 item\">
							<div class=\"thumbnail\">
								<div class=\"img-pic2\">
							  <a href=\"".$packingFolders."/packing-page".$news_rows['ID'].".html\"  title=\"".$news_rows['Title']."\" class=\"c-img\"><img src=\"../".$packingFolders."/".$SmallFoldersProducts."/".$news_rows['Pic']."\" alt=\"".$news_rows['Title']."\" /></a>
							  </div>
							  <div class=\"caption pro-name\">
								<a href=\"".$packingFolders."/packing-page".$news_rows['ID'].".html\"  title=\"".$news_rows['Title']."\">".$news_rows['Title']."</a>
							  </div>
							</div>
						  </div>";
					
					$newstitle=$news_rows['Title'];
					$newimg = "<center><img src=\"../../".$packingFolders."/".$BigFoldersProducts."/".$news_rows['Pic']."\" class=\"img-responsive\"  ondragstart=\"return false;\"/></center>";
					$newstext = str_replace("src=\"../", "src=\"../../", $news_rows['Text']);
					$ls_newid = $news_rows['ID'];
					createFolder("../m/".$packingFolders);
					
					$index_newspath="../".$mobi_templates_var."/packingshow.html";		//模板地址
					if(file_exists($index_newspath)){
						$ls_title=$news_rows['newsTitle'];				//title
						$ls_keywords=$news_rows['newsKeywords'];			//Keywords
						$ls_description=$news_rows['newsDescription'];	//Description
						$ls_cate=$pro_cate;
						$ls_s_cate=$s_pro_cate;								//左侧产品类别;
						$ls_motif=$s_m2_cate;
						$ls_menu=$menu_pro;									//主菜单
						$ls_newstitle=$newstitle ;							//新闻标题
						$ls_newimg=$newimg;
						$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_s_cate}",$ls_s_cate,$newscontent);
						$newscontent = str_replace("{ls_p_cate}",$ls_p_cate,$newscontent);
						$newscontent = str_replace("{ls_m_cate}",$p_m_cate1,$newscontent);
						$newscontent = str_replace("{ls_motif}",$ls_motif,$newscontent);
						$newscontent = str_replace("{ls_propage}",$ls_propage,$newscontent);
						$ls_facebook_twitter = str_replace("../", "../../",$facebook_twitter);
						$newscontent = str_replace("{ls_weibo}",$ls_facebook_twitter,$newscontent);
						$ls_facebook_twitter_share = $facebook_twitter_share;
						$newscontent = str_replace("{ls_weiboshare}",$ls_facebook_twitter_share,$newscontent);
						
						$ls_indicatebar = "<li><a href=\"../index.html\">Home</a></li>
								   <li><a href=\"../packing.html\">packing</a></li>";
						$newscontent = str_replace("{ls_indicatebar}",$ls_indicatebar,$newscontent);
						
						$newscontent = str_replace("{ls_newstime}",$ls_newstime,$newscontent);
						$newscontent = str_replace("{ls_newid}",$ls_newid,$newscontent);
						$newscontent = str_replace("{ls_click_n}",$ls_click_n,$newscontent);
						
						$newscontent = str_replace("{ls_newstitle}",$ls_newstitle,$newscontent);
						$newscontent = str_replace("{ls_newimg}",$ls_newimg,$newscontent);
						
						$newscontent = str_replace("{ls_newstext}",$ls_newstext,$newscontent);
						$newscontent = str_replace("{ls_newsdongtai}",$ls_newsdongtai2,$newscontent);		//子目录下新闻
			//new
						$newscontent = str_replace("{ls_newsgonggao}",$ls_newsgonggao2,$newscontent);
						$newscontent = str_replace("{ls_newsall}",$ls_newsall2,$newscontent);
						$newscontent = str_replace("{ls_newstieshi}",$ls_newstieshi2,$newscontent);
						$newscontent = str_replace("{ls_site_cate}",$s_site_cate,$newscontent);
			
						$newscontent = str_replace("{ls_url}",$ls_url,$newscontent);
						$newscontent = str_replace("{ls_foot}",$ls_foot,$newscontent);
						$newscontent = str_replace("{ls_addprolink}",$ls_addprolink,$newscontent);	//指向主菜单中的Products链接
						$newscontent = str_replace("{ls_addnewprolink}",$ls_addnewprolink,$newscontent);	//指向主菜单中的NewProducts链接
						
						$newscontent = circleNavigationLinkNews($news_rows['ID'],'B','{ls_nextlink}',$newscontent,"ls_packing",$catenews['cateName'],"packing",$suffix_str2,false);
						$newscontent = circleNavigationLinkNews($news_rows['ID'],'F','{ls_previouslink}',$newscontent,"ls_packing",$catenews['cateName'],"packing",$suffix_str2,false);
						
						$newscontent = str_replace("{newstag}",$newstag,$newscontent);
						if($suffix_str == "_dongtai"){
							$newscontent = str_replace("<li id=\"current\"><a href=\"../news.html\">","<li><a href=\"../news.html\">",$newscontent);
							$newscontent = str_replace("<li><a href=\"../technology.html\">","<li id=\"current\"><a href=\"../technology.html\">",$newscontent);
						}
								
						$filename="../m/".$packingFolders."/packing-page".$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 "'生成文件".$filename."失败！";
						 } 
						fclose ($handle); //关闭指针
						 //echo "创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\"><u>返回</u></a><br/><br/>";
						fclose ($fp);
					}else{
						echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";
					}
				}
				$list.="</div>";
				
				//页码计算
				$propage=getPagess("packing.html",$allpages,$ls_current_page);
				
				$index_path="../".$mobi_templates_var."/packing.html";				//车间模板地址
				$ls_title=$news_rows3['inTitle'];												//title
				$ls_keywords=$news_rows3['inKeywords'];										//Keywords
				$ls_description=$news_rows3['inDescription'];							//Description
				$ls_cate=$cate;											//左侧产品类别
				$ls_motif=$s_m_cate;
				$ls_menu=$menu;											//主菜单
				$ls_list=$list ;										//车间图片列表
				$ls_introduction=$introduction;                           //简介
				$ls_propage=$propage;									//车间分页页码
				$ls_foot=$foot;											//底部信息
				
				$ls_feedbackemail="";
				$mainpart=$ls_list;
				$mainpartsubject="packing_m";
				$filename = "../m/{$indexpath}";
				writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
			}
	  		
	  		echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
		
		 if($ls!="all_m" && $ls!="all_products")
 {break;}
 
  case "contact_m":  //生成 contact us
			
		$contactus.="Address:".$row['address']."<br>\n";
		$contactus.="Tel:<a class='zzp-tel ui-link' href='tel:".$row['tel']."'>".$row['tel']."</a>".$row['tel']."<br>\n";
		$contactus.="Fax:".$row['fax']."<br>\n";
		$contactus.="E-Mail:<a href=\"mailto:".$row['email']."\">".$row['email']."</a><br>\n";
		$contactus.="MSN:<a href=\"mailto:".$row['MSN']."\">".$row['MSN']."</a><br>\n";
		$contactus.="URL:<a href=\"http://".$row['website']."\">".$row['website']."</a><br>\n";
		$contactus.=$ContactAttach_m; //联系我们的附件文字： google地图， 地区环境
		
		$information_sql="select * from ls_information where inMenu='contact' ";
		$information_query=$opendb->query($information_sql);
		$information_rows=mysql_fetch_assoc($information_query);
		
		$ls_title=$information_rows['inTitle'];//title
		$ls_keywords=$information_rows['inKeywords'];	//Keywords
		$ls_description=$information_rows['inDescription'];//Description
		
		$index_path="../".$mobi_templates_var."/contact.html";//模板地址
		$ls_title=$config_rows['companyName'];//title
		$ls_keywords=$config_rows['siteKeywords'];	//Keywords
		$ls_description=$config_rows['siteDescription'];//Description
		//$ls_cate=$pro_cate;																						//左侧产品类别
		//$ls_menu=$menu_pro;																						//主菜单
		$ls_cate=$p_m_cate;	//左侧产品类别
		$ls_motif=$s_m_cate;
		$ls_menu=$menu;	//主菜单
		$ls_contactus = str_replace("href=\"../", "href=\"", $information_rows['content']);//contact us
		$ls_foot=$foot;//底部信息
		
		$ls_propage="";
		$ls_feedbackemail="";
		$mainpart=$ls_contactus;
		$mainpartsubject="contactus_m";
		$filename = "../m/contact.html"; 
		writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,
$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$ls_addprolink,$ls_addnewprolink,$newstag);
	 	 if($ls!="all_m" && $ls_m!="all_products")
 {break;}	
 
 		case "nomenufiles_m":				//生成首页
			$ls_cate=$p_m_cate;	//左侧产品类别
			$ls_menu=$menu;				//主菜单
			$ls_classpro=$classpro;			//类别作品
			$ls_hotpro=$hotpro;			//功能页面热点作品
			$ls_newpro=$newpro;			//功能页面新作品
			$ls_title=$config_rows['companyName'];												//title
			$ls_keywords=$config_rows['siteKeywords'];										//Keywords
			$ls_description=$config_rows['siteDescription'];
			// $ls_title, $ls_keywords, $ls_description from public
			$ls_foot=$foot;				//底部信息
			$ls_site_cate = $site_cate;
			foreach($m_generalCreateFiles as $createdfile){
				$index_path="../".$mobi_templates_var."/";//模板目录
				$mainpartsubject="createdfile_m";
				$filename="../m/".$createdfile;
				$index_path=$index_path.$createdfile;
				$mainpart="";
				$ls_introduction="";
				$ls_feedbackemail="";
				$ls_propage="";
				writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_motif,$ls_menu,$ls_foot,
	$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$ls_addprolink,$ls_addnewprolink,$newstag,$ls_hot_behalf);
			}
	
			echo "生成member 目录下文件--------------------<br />";
			foreach($generalCreateFilesMembers as $createdfile){			//生成member 下文件
				$subFolder=true;		//设置子目录 替换../../ 为 ../
				$index_path="../".$mobi_templates_var."/";//模板目录
				$mainpartsubject="createdfile_m";
				$filename="../member/".$createdfile;
				$index_path=$index_path.$createdfile;
				$mainpart="";
				$ls_introduction="";
				$ls_feedbackemail="";
				$ls_propage="";
				writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_menu,$ls_foot,
	$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$ls_addprolink,$ls_addnewprolink,$newstag,$ls_hot_behalf);
			}
			$subFolder=false;
				
			echo "生成agent 目录下文件--------------------<br />";
			foreach($generalCreateFilesAgents as $createdfile ) {			//生成agent 下文件
				$subFolder=true;
				$index_path="../".$mobi_templates_var."/";//模板目录
				$mainpartsubject="createdfile";
				$filename="../agent/".$createdfile;
				$index_path=$index_path.$createdfile;
				$mainpart="";
				$ls_introduction="";
				$ls_feedbackemail="";
				$ls_propage="";
				writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_menu,$ls_foot,
	$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$ls_addprolink,$ls_addnewprolink,$newstag,$ls_hot_behalf);
			}
			$subFolder=false;
			if($ls!="all" && $ls!="all_products"){
				//生成全部页面，不包括作品页，否则break 
				break;
			}
 
 		//生成手机产品页
		case "all_products_m": //生成全部页面，包括产品页，否则break	
		case "products_m":  //生成产品页 products
			
			$pro_pic_sql="SELECT * FROM `ls_products` WHERE `cateName` IS NOT NULL and catePic !='' order by Num";
			$pro_pic_query=$opendb->query($pro_pic_sql);
			
			$ls_pro = "<div class=\"row pro_list\">";
			while($pro_pic_rows=mysql_fetch_assoc($pro_pic_query)){
				$ls_pro .= "<div class=\"col-xs-4\"><div class=\"thumbnail\"><div class=\"img-pic\"><a href=\"".$pro_pic_rows['cateFolders']."/".$pro_pic_rows['cateFolders'].".html\"><img src=\"../".$pro_pic_rows['cateFolders']."/".$pro_pic_rows['catePic']."\" name=\"imgs\" alt=\"".$pro_pic_rows['midcateName']."\" /></a></div><div class=\"caption pro-name\"><a href=\"".$pro_pic_rows['cateFolders']."/".$pro_pic_rows['cateFolders'].".html\">".$pro_pic_rows['cateName']."</a></div></div></div>";
			}
			$ls_pro .= "</div>";

			$index_newspath="../".$mobi_templates_var."/prolist.html";		//模板地址
			$ls_title = $config_row['companyName'];				//title
			$ls_keywords=$config_row['siteKeywords'];			//Keywords
			$ls_description=$config_row['siteDescription'];	//Description
			$ls_cate=$pro_cate;
			$ls_s_cate=$s_pro_cate;								//左侧产品类别;
			$ls_s_news = $ls_h1_news;
			$ls_p_cate=$s_p_cate;								//左侧产品类别;
			$ls_f_cate=get_pro_cate(1);
			$ls_motif=$s_m2_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("../","",$newscontent);
			$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_s_cate}",$ls_s_cate,$newscontent);
			$newscontent = str_replace("{ls_pro}",$ls_pro,$newscontent);
			$newscontent = str_replace("{ls_p_cate}",$ls_p_cate,$newscontent);
			$newscontent = str_replace("{ls_f_cate}",$ls_f_cate,$newscontent);
			$newscontent = str_replace("{ls_motif}",$ls_motif,$newscontent);
			$newscontent = str_replace("{ls_propage}",$ls_propage,$newscontent);
			$ls_facebook_twitter = $facebook_twitter;
			$newscontent = str_replace("{ls_weibo}",$ls_facebook_twitter,$newscontent);
			$ls_facebook_twitter_share = $facebook_twitter_share;
			$newscontent = str_replace("{ls_weiboshare}",$ls_facebook_twitter_share,$newscontent);
			
			$ls_indicatebar = "<li><a href=\"index.html\">Home</a></li>
                               <li style='text-transform : capitalize;'>Products</li>";
			$newscontent = str_replace("{ls_indicatebar}",$ls_indicatebar,$newscontent);
			$newscontent = str_replace("{ls_news}",$ls_s_news,$newscontent);
			$newscontent = str_replace("{ls_newstime}",$ls_newstime,$newscontent);
			$newscontent = str_replace("{ls_newid}",$ls_newid,$newscontent);
			$newscontent = str_replace("{ls_click_n}",$ls_click_n,$newscontent);
			$newscontent = str_replace("{ls_newstitle}",$ls_newstitle,$newscontent);
			$newscontent = str_replace("{ls_newstext}",$ls_newstext,$newscontent);
			$newscontent = str_replace("{ls_newsdongtai}",$ls_newsdongtai2,$newscontent);		//子目录下新闻
//new
			$newscontent = str_replace("{ls_newsgonggao}",$ls_newsgonggao2,$newscontent);
			$newscontent = str_replace("{ls_newsall}",$ls_newsall2,$newscontent);
			$newscontent = str_replace("{ls_newstieshi}",$ls_newstieshi2,$newscontent);
			$newscontent = str_replace("{ls_site_cate}",$s_site_cate,$newscontent);

			$newscontent = str_replace("{ls_url}",$ls_url,$newscontent);
			$newscontent = str_replace("{ls_foot}",$ls_foot,$newscontent);
			$newscontent = str_replace("{ls_addprolink}",$ls_addprolink,$newscontent);	//指向主菜单中的Products链接
			$newscontent = str_replace("{ls_addnewprolink}",$ls_addnewprolink,$newscontent);	//指向主菜单中的NewProducts链接
			$filename="../m/prolist.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 "'生成文件".$filename."失败！";
			 } 
			fclose ($handle); //关闭指针
				echo "创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\"><u>返回</u></a><br/><br/>";
			fclose ($fp);
			
			//echo "<h1>".$ls."</h1>";
			$menuListscateidall=0;
			/*$cate_sql="select * from ls_products where midcateID is null and midcateName 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 order by Num asc";*/
			//查找大类的SQL语句
			$cate_sql = 'SELECT * FROM `ls_products` WHERE cateName IS NOT NULL';
			$cate_query=$opendb->query($cate_sql);
			while($cate_rows=mysql_fetch_assoc($cate_query)){
				if($_GET['productsall']=="ok"){
					$cateid=$cate_rows['ID'];
					$menuListscateid=0;
				}
				$products_sql_p="select * from ls_products where branchID=0 and midcateID 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 subcateName is null and subcateFolders is null and subcateBrief is null and subcateID is null ";
				//大类
				if( $cateid!="" && $midcateid=="" && $subcateid=="" ){
					//大类下有中类
					//echo "<h1>".$cateid."</h1>";
					$sqlstr1="SELECT `ID` FROM `ls_products` WHERE midcateID=".$cateid;
					$query1=$opendb->query($sqlstr1);
					$mynum1=mysql_num_rows($query1);
					if($mynum1!=0){
						//有中类
						$DetailPage=1;
						writeProPageIndex_m($products_sql,$cateid,$midcateid,$subcateid);// write 所有大枝类的details
						$DetailPage=0; //reset flag
			
						$menuListscateidall++;
						if($_GET['productsall']=="ok"){$menuListscateid=$menuListscateidall;}		// if it is all products set $menuListscateid
						while($myrows1=mysql_fetch_assoc($query1)){
							$sqlstr2="select ID from ls_products where subcateID =".$myrows1['ID']." ";
							$query2=$opendb->query($sqlstr2);
							$mynum2=mysql_num_rows($query2);
							if($mynum2!=0){
								//有小类
								$midcateid=$myrows1['ID'];
								$mid_id = $midcateid;
								$DetailPage=1;
								writeProPageIndex_m($products_sql,$cateid,$midcateid,$subcateid);// write 所有中枝类的details
								$DetailPage=0; //reset flag
			
								while($myrows2=mysql_fetch_assoc($query2)){
									$productID=" productID=".$myrows2['ID'];
									$products_sql=$products_sql_p." and ".$productID;
									$subcateid=$myrows2['ID'];
									$midcateid = $mid_id;
									writeProPageIndex_m($products_sql,$cateid,$midcateid,$subcateid);
									$midcateid="";
									$subcateid="";
								}
							}
							else{
								//没有小类
								$productID=" productID=".$myrows1['ID'];
								$products_sql=$products_sql_p." and ".$productID;
								$midcateid=$myrows1['ID'];
								writeProPageIndex_m($products_sql,$cateid,$midcateid,$subcateid);
								$midcateid="";
							}
						}
					}
					else{
						$products_sql=$products_sql_p." and productID=".$cateid;
						writeProPageIndex_m($products_sql,$cateid,$midcateid,$subcateid);
					}
				}
			
				
				//中类
				if($cateid!="" && $midcateid!="" && $subcateid==""){
					//中类下有小类
					$sqlstr="select ID from ls_products where subcateID =".$midcateid." ";
					$query1=$opendb->query($sqlstr);
					$mynum=mysql_num_rows($query1);
					if($mynum!=0){
						while($myrows=mysql_fetch_assoc($query1)){
								$productID=" productID=".$myrows['ID'];
								$products_sql=$products_sql_p." and ".$productID;
								$subcateid=$myrows['ID'];
								writeProPageIndex_m($products_sql,$cateid,$midcateid,$subcateid);
								$subcateid="";
						}
					}
					else{
						//中类下没有小类
						$products_sql=$products_sql_p." and productID=".$midcateid;
						writeProPageIndex_m($products_sql,$cateid,$midcateid,$subcateid);
			
					}
				}
				//小类
				if($cateid!="" && $midcateid!=""&& $subcateid!=""){
					$products_sql=$products_sql_p." and productID=".$subcateid;
					writeProPageIndex_m($products_sql,$cateid,$midcateid,$subcateid);
				}
				//echo 	$products_sql;
				echo "生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=products\"><u>返回</u></a><br/>
				---------------------------------------------------------------------------------------------------<br/><br/><br/>";																				
				if($_GET['productsall']=="ok")//不生成全部产品就执行一次循环退出
				{}
				else
				{break;}
			}// end of cate while
			if($ls!="all_products"){
				//生成全部页面，不包括产品页，否则break 
				break;
			}
}
?></td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>
