<?php
require_once('_approot.php');	
require_once('inc/public.php');

// $ls="all" 生成全部，不包含产品页； $ls!="all_products" 生成全部，包含产品页；
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
$_SESSION['transTotal']=0;  //翻译字符计数
$_SESSION['transfast']=0;  //快表条数
$_SESSION['transfastTotal']=0;  //快表字数
$_SESSION['transslow']=0;  //慢表条数
$_SESSION['transslowTotal']=0;  //慢表字数 

//修改最大执行时间
ini_set('max_execution_time', '0');
//修改此次最大运行内存
ini_set('memory_limit','512M');
set_time_limit(0);   //控制运行时间，默认是30s，如 set_time_limit(300),其中将秒数设为0 ，表示持续运行！
//echo $translates;  //统计需要翻译的语言串
global $count_num;
$count_num = 0;
require_once('inc/ls_m_syscode.php');
include("widget/ls_langpath.php");   //多语种路径判断
if($_SESSION['landir']!=""){ //21-4-27
	$currlan=str_replace("/","",$_SESSION['landir']);
	$lanvar="inc/_lang_".$currlan.".php";
	if(file_exists($lanvar)){
		include $lanvar;
	 	$lang_en = ${"lang_".$currlan};//lan_fr
	}
	
}
?>
<!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  bgcolor="#f4f4f4">
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1"  bgcolor="#f0f0ee">
<tr>
                <td height="18" style="border-bottom:2px solid #00c0ef; padding-bottom:5px;"><div align="center"><font color="#3c8dbc" style="font-size:16px;">生成结果</font></div>
				</td>
			</tr>
  <tr>
   <tr  bgcolor="#f0f0ee">
    <td height="20" align="right" valign="top" style="padding-right:90px"><a href="<?=$_SERVER["HTTP_REFERER"]?>">返回 </a><br /></td>
  </tr>
    <td height="13" valign="top"><table width="100%" border="0" align="center" cellpadding="3" cellspacing="1"  bgcolor="#f0f0ee">
      <tr bgcolor="#f0f0ee">
        <td style="padding-left:10px;" ><?php
	
	$ls=$_GET['ls'];
	$translates=$_GET['translate'];   //翻译参数
	$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
	if($translates!="")	if(!$googleTrans || (strpos($transFlags,$translates)===false)) exit; 

	//主菜单 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=mysqli_fetch_array($tem_query);
	//print_r($row);exit;
	$templates_var = $config_row['templates'];
	$ls_sitebrand= $config_row['MSN4']; // 品牌
	$ls_corekeyword= $config_row['MSN3'];
	 
	
	$mobi_tem_sql="select * from ls_mobiconfig order by ID";	
	$mobi_tem_query=$opendb->query($mobi_tem_sql);
	$mobi_row=mysqli_fetch_array($mobi_tem_query);
	$mobi_templates_var = $mobi_templates;
	

//类产品展示 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=mysqli_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 = mysqli_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 = mysqli_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 = mysqli_fetch_assoc($opendb->query($search_catename2));
			
			//获得关于大类的记录
			$search_catename3 = "SELECT * FROM ls_products WHERE ID={$catename_query2[midcateID]}";
			$catename_query3 = mysqli_fetch_assoc($opendb->query($search_catename3));
			
			$class_name = $catename_query['subcateName'];
		}
		include("_catepro_selectpic.php");  //{ls_classpro}
	}		
}	
	
 
	//默认 $ls_classproType="pic" 或空 是图片列表
	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=mysqli_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=mysqli_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++;
			include("_catepro_pic.php");  //{ls_classpro}
		}		
	}
	
// $ls_classproType="picIntro" 是图片文字列表 getpiclink error
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=mysqli_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=mysqli_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'],$productpicrp,clearFolder($product_class_rows['productName'])."-".$product_class_rows['ID'].".html"); // error 没测试
			//echo $classpro_rows['ID']."--".$product_class_piclink['picsrc']; // /thumbnails/1361107436.jpg  带/
			
			 include("_catepro_picintro.php");  // {ls_classpro}

		  }//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=mysqli_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=mysqli_num_rows($pro_midcate_query);
	  
				include("_catepro_catelist.php");  //  {ls_classpro}
		}
		$s_classpro.="</ul>\r\n ";
		//echo $s_classpro;
		$classpro=str_replace("../","",$s_classpro);//cate
	}
	//类产品展示 End
	
		//首页产品展示 Start
		//首页类代表图  {ls_cateprohome} $cateHome  $cateProHome constant
	$productscate_sql="select * from ls_products where midcateName is null and cateName is not  null   and subcateName is null and subcateFolders is null and subcateBrief is null and subcateID is null and productName is null and enable=1 order by Num asc limit ".$cateHome ;
	
	
	$productscate_query=$opendb->query($productscate_sql);
	$cateprohome="";

	while($productscate_rows=mysqli_fetch_assoc($productscate_query)){
		$cateName1=$productscate_rows['cateName'];
		$cateFolders1=$productscate_rows['cateFolders'];
		$cateNameID1=$productscate_rows['ID'];
		$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 and productID='".$cateNameID1."' ";
	
		$products_query=$opendb->query($products_sql);
		$products_nums_cate2=mysqli_num_rows($products_query);
		if($products_nums_cate2==0){ //不是大类下产品，看中类
		
			$midproducts_sql="select * from ls_products  where enable=1 and midcateID='".$cateNameID1."' "; //看中类
	
				$products_query=$opendb->query($midproducts_sql);
				$products_nums_cate2=mysqli_num_rows($products_query);
				 
				if($products_nums_cate2==0){ //大类下没zhonglei ，不再查，认为没加产品。不适合有小类的情况
					$noProducts=true;
					$cateFolders1.= '/' . $cateFolders1.'.html';
				}
				else
				{
						$products1_sql="select * from ls_products where  midcateID=$cateNameID1 limit 1";
						$products1_query=$opendb->query($products1_sql);
						$products1_rows=mysqli_fetch_assoc($products1_query);
	
						$cateFolders1 .= '/' . $products1_rows['midcateFolders']. '/' .$products1_rows['midcateFolders'].'.html';
						
						$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_sqladd1="and (";
						$i1=1;
						while($products_rows=mysqli_fetch_assoc($products_query)){
	
							$products_sqladd1.="   productID='".$products_rows['ID']."' ";  // 
							if($i1!=$products_nums_cate2) $products_sqladd1.=" or ";
							$i1++;
	
						}
						$products_sqladd1.=" )";
						
						$products_sql.=$products_sqladd1;
				}
		} else{
			
			$cateFolders1.= '/' .$cateFolders1.'.html';
		}
		 $products_sql.=" order by Num asc limit ".$cateProHome ;
		$count=0;
		 $cateprohome.= " <div class=''>
		  <h2 class='tab-h2'>
		  <a href='".$cateFolders1."'> $cateName1</a>                                    
		  </h2>
		</div>";
		$products_query=$opendb->query($products_sql);
	
		while($products_rows=mysqli_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";
	
			
	
			switch($homehrefStytle){
				case "prohref":
					$filename=$products_rows['filename']==""?clearFolder(strtolower(pathProName($products_rows['productName'])))."-".$products_rows['ID'].".html":$products_rows['filename'];
					$catehomehref = $profile."/".$filename;	
					//$catehomehref = $profile."/".clearFolder(strtolower(pathProName($products_rows['productName'])))."-".$products_rows['ID'].".html";
				break;
	
				case "classhref":
					$catehomehref = $profile."/".getproductpath($products_rows['productID']).".html";
				break;
			}
	 
			$cateprohome.="<div class=\"col-xs-6 col-sm-6 col-md-3 col-lg-3\">
				<div class=\"thumbnail pro\"> <a href=\"".$catehomehref."\"  title=\"".$products_rows['productName']."\"><img src=\"".$prosrc."\"  alt=\"".$products_rows['productName']."\"  title=\"".$products_rows['productName']."\"/></a>
					<div class=\"caption pro-name\"> <a href=\"".$catehomehref."\" title=\"".$products_rows['productName']."\"><translate>".$products_rows['productName']."</translate></a></div>
					<div class=\"caption pro-description\"> <a href=\"".$catehomehref."\"  title=\"".$products_rows['productName']."\"><translate>".$products_rows['productDescription']."
					</translate></a>
					<div class=\"o-btn\">
							<a href=\"".$catehomehref."\"  title=\"".$products_rows['productName']."\"><translate>More</translate></a>
						</div>
					</div>
				</div>
			</div>";
	
		}
	}
	//首页类代表图 end
//	echo $cateprohome;

	//首页产品展示2 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;
	$hproi=0;
	while($products_rows=mysqli_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]);
		include("_home_pro.php");  //首页产品  {ls_homepro} 
		$hproi++;
	}
	//首页产品展示 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=mysqli_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\" title=\"<translate>".$products_rows['productName']."</translate>\"><img src=\"".$prosrc."\" border=\"0\" alt=\"".$products_rows['productName']."\"  title=\"<translate>".$products_rows['productName']."</translate>\" /></a>";
		$hotpro.="</div>";
		$hotpro.="<div class=\"proItem\" ><a href=\"".$prolink."\" target=\"_blank\" title=\"<translate>".$products_rows['productName']."</translate>\">".$products_rows['productName']."</a></div>";
	//	$hotpro.="<div class=\"proItem\" ><a href=\"".$prolink."\" target=\"_blank\" title=\"<translate>".$products_rows['productName']."</translate>\">".$products_rows['productName']."</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=mysqli_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\" title=\"<translate>".$motif_rows['motif_name']."</translate>\">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=mysqli_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['productItemNo']."\" /></a>";
		$newpro.="</div>";
		$newpro.="<div class=\"proItem\" ><a href=\"".$prolink."\" target=\"_blank\">".$products_rows['productItemNo']."</a></div>";
		$newpro.="<div class=\"proItem\" ><a href=\"".$prolink."\" target=\"_blank\">".$products_rows['productItemNo']."</a></div>";
		$newpro.="</div>";
		
	}	
	
	//新产品展示 End
	
	//首页关于我们 start {ls_about}
	$inf_sql="select * from ls_information where inMenu = 'aboutus' order by ID";	
	$inf_query=$opendb->query($inf_sql);
	$inf_row=mysqli_fetch_array($inf_query);
	
	$lenght_sql="select * from ls_functioncode where codeID = 'aboutLenght' order by ID";	
	$lenght_query=$opendb->query($lenght_sql);
	$lenght_row=mysqli_fetch_array($lenght_query);
	
	//欢迎页，网站地图 welcome
		
		include("_home_about.php"); //首页关于我们
	
	
	$allabout=str_replace("../", "", $inf_row['content']);

	$file_welcome="../".$templates_var."/welcome.html";	//模板地址
/*	$ls_title=$config_row['companyName'];					//title
	$ls_keywords=$config_row['siteKeywords'];				//Keywords
	$ls_description=$config_row['siteDescription'];		//Description
*/	
	//  sitemap 站点地图 $s_site_cate P -> {ls_site_cate} T
	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_d_cate}",$d_cate,$procontent);
		$ls_lineno=__LINE__.(__FUNCTION__==""?"":"， 函数：".__FUNCTION__).(__CLASS__==""?"":"， 类：".__CLASS__);

		$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)){ 
			if($ls_debug) echo "文件：".$profilename."不可写，请检查其属性后重试！";
		}
		if (!fwrite ($handle,$procontent)){  //将信息写入文件
			if($ls_debug) echo "".$profilename."失败！";
		}else{
			echo "生成 <a href='".$profilename."'>".$profilename."</a>";
			if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;
			echo "<br>";
		 	$writeurl=$_SERVER['HTTP_HOST']."/".str_replace("..","",$profilename);
		 	include("inc/_inc_when_write_file.php");

		}
		fclose ($handle); //关闭指针
		//die ("创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\"><u>返回</u></a>");
		fclose ($fp);
	}
	


	foreach (str_split($translates, 2) as $trans_val) {
		$translate = $trans_val; //传递很重要的翻译参数
		// 记录开始时间
		$time_start = getmicrotime();
		//sleep(10); //耗时的处理过程
		$lanname = deep_in_array($trans_val, $translate_name);
		echo "<h3><font color='#F00'>".$lanname['name']."</font></h3>";
		
		if($lanname['name']!=""){
			if($simuTransCons==1) echo " 模拟翻译,";
			if($simuTransLow) echo " 底层模拟,";
			if($_SESSION['transAll']==1) echo " 覆盖,"; else echo " 不覆盖";
			echo ", 引用路径： ".$mutiLangDomianFlag;
			echo "<br/><br/>";
		
		}

	
	switch($ls){
		case "all_products": //生成全部页面，包括产品页，否则break	
		case "products":  //生成产品页 products
			
			$pro_pic_sql="SELECT * FROM `ls_products` WHERE `cateName` !=''  and enable=1 order by Num";// 没有类代表图，不展示 and catePic !='' 
			$pro_pic_query=$opendb->query($pro_pic_sql);
			$ls_pro = "<div class=\"row pro_list\">";
			// 产品信息 {ls_pro}
			$ls_lineno=__LINE__.(__FUNCTION__==""?"":"， 函数：".__FUNCTION__).(__CLASS__==""?"":"， 类：".__CLASS__);

			while($pro_pic_rows=mysqli_fetch_assoc($pro_pic_query)){
				crmkdir("../".$pro_pic_rows['cateFolders']);
				include("_products_prolist.php");  // {ls_classpro}
			}
			$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_cate;								//左侧产品类别;原来$s_pro_cate;	
				$ls_d_cate=$d_cate;								//
				$ls_s_news = $ls_h1_news;
				$ls_p_cate=$s_p_cate;								//左侧产品类别;
				$ls_languages = $languages;                         //语言国旗
				$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);
				//$ menu_pro P -> $ ls_menu T -> { ls_menu} T
				$newscontent = str_replace("{ls_menu}",$ls_menu,$newscontent);
				//   $ languages  P -> $ ls_languages T 等 -> { ls_languages}
				$newscontent = str_replace("{ls_languages}",$ls_languages,$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);
				$tem_sql="select * from ls_config order by ID";	
				$tem_query=$opendb->query($tem_sql);
				$row=mysqli_fetch_array($tem_query);
				$copyright = $row['copyright'];
				$newscontent = str_replace("{ls_copyright}",$copyright,$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\">".$lan['home']."</a></li>
								   <li style='text-transform : capitalize;'>".$lan['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);
				$newscontent = str_replace("{ls_classpro}",$ls_pro,$newscontent); //products 页面,在str_replace("../","",$newscontent);后面
				$filename="../prolist.html";

				$ls_url="";
				$addmnurl=""; //ls_menu
				$content=$newscontent;
				$ls_weburl1=  $_SERVER['HTTP_HOST'].str_replace("..","",$filename); //非80端口，会输出端口
				include("inc/_inc_allrepltags.php"); 
				$newscontent=$content;
				$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}",str_replace("../","",$ls_p_cate),$newscontent);


			if($translate != ''){

				//翻译代码
				$folder_name = $translate;
				$r_name = deep_in_array($folder_name, $translate_name);
		
				$translateFile = "../".$r_name['folder_name'];
				createFolder($translateFile);
				$transFile = str_replace("../", "", $filename);
				
				if (is_file ($translateFile."/".$transFile)){ 
					 @unlink ($translateFile."/".$transFile); //若文件已存在，则删除
				}
				
				if (copy("../.htaccess", "../".$r_name['folder_name']."/.htaccess")){
					if($ls_debug) echo "复制"."../".$r_name['folder_name']."/.htaccess文件成功！<br />";
				}else{
					if($ls_debug) echo "复制"."../".$r_name['folder_name']."/.htaccess文件失败！<br />";
				}
				
				if(translateApp($newscontent, $translateFile."/".$transFile, $r_name['translate_name'])){
					echo "创建 <a href='".$translateFile."/".$transFile."'  target='_blank'>".$translateFile."/".$transFile."</a>成功！<a href=\"temp.php?ls=normal\">返回</a>";
					if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;
					echo "<br/><br/>";

				}else{
					if($ls_debug) echo "生成文件".$translateFile."/".$transFile."失败！<br>";
				}
			}else{
				if (is_file ($filename)){ 
					 @unlink ($filename); //若文件已存在，则删除
				}
				//英文网站去除<translate>标签
				$translate_str = $newscontent;
				$p = "%<translate>(.*?)</translate>%si";    //正则表达式
				preg_match_all($p, $newscontent, $arr);
				$temarr = $arr[1];
				
				$source="en";
				$targets = $target;
			
				foreach($temarr as $val){
					$newscontent = str_replace("<translate>".$val."</translate>", $val, $newscontent);
				}
				
			   $handle   = fopen ($filename,"w"); //打开文件指针，
						 
				if (!is_writable ($filename)){ 
					if($ls_debug)  echo "<script>alert('文件：".$filename."不可写，请检查其属性后重试！');history.go(-1);</script>";
				}
				if (!fwrite ($handle,$newscontent)){  //将信息写入文件
					if($ls_debug) echo "'生成文件".$filename."失败！";
				 } 
					fclose ($handle); //关闭指针
					echo "创建<a href='".$filename."'  target='_blank'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\">返回</a>";
					if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;
					echo "<br/><br/>";
					$writeurl=$_SERVER['HTTP_HOST']."/".str_replace("..","",$filename);
					include("inc/_inc_when_write_file.php");

			}
				fclose ($fp);
			}else{
				if($ls_debug) 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=mysqli_fetch_assoc($cate_query)){
				crmkdir("../".$cate_rows['cateFolders']);
				if($_GET['productsall']=="ok"){
					$cateid=$cate_rows['ID'];
					$menuListscateid=0;
				}
				$products_sql_p="select * from ls_products where  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 "; //branchID=0 and
				//大类
				if( $cateid!="" && $midcateid=="" && $subcateid=="" ){
					//大类下有中类
					//echo "<h1>".$cateid."</h1>";
					$sqlstr1="SELECT ID,midcateFolders FROM ls_products WHERE midcateID=".$cateid."  ";
					$query1=$opendb->query($sqlstr1);
					$mynum1=mysqli_num_rows($query1);
					if($mynum1!=0){
						//有中类
						$DetailPage=1;
						writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid,$translate);// write 所有大枝类的details
						$DetailPage=0; //reset flag
			
						$menuListscateidall++;
						if($_GET['productsall']=="ok"){$menuListscateid=$menuListscateidall;}		// if it is all products set $menuListscateid
						while($myrows1=mysqli_fetch_assoc($query1)){
							crmkdir("../".$cate_rows['cateFolders']."/".$myrows1['midcateFolders']);
   						    $sqlstr2="select * from ls_products where subcateID =".$myrows1['ID']." ";
							$query2=$opendb->query($sqlstr2);
							
							$mynum2=mysqli_num_rows($query2);
							if($mynum2!=0){
								//有小类
								$midcateid=$myrows1['ID'];
								$mid_id = $midcateid;
								$DetailPage=1;
								writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid,$translate);// write 所有中枝类的details
								$DetailPage=0; //reset flag
			
								while($myrows2=mysqli_fetch_assoc($query2)){
									crmkdir("../".$cate_rows['cateFolders']."/".$myrows1['midcateFolders']."/".$myrows2['midcateFolders']);
									$productID=" productID=".$myrows2['ID'];
									$products_sql=$products_sql_p." and ".$productID;
									$subcateid=$myrows2['ID'];
									$midcateid = $mid_id;
									writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid,$translate);
									$midcateid="";
									$subcateid="";
								}
							}
							else{
								//没有小类
								$productID=" productID=".$myrows1['ID'];
								$products_sql=$products_sql_p." and ".$productID;
								$midcateid=$myrows1['ID'];
								writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid,$translate);
								$midcateid="";
							}
						}
					}
					else{
						$products_sql=$products_sql_p." and productID=".$cateid;
						writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid,$translate);
					}
				}

				//中类
				if($cateid!="" && $midcateid!="" && $subcateid==""){
					//中类下有小类
					$sqlstr="select ID from ls_products where subcateID =".$midcateid." ";
					$query1=$opendb->query($sqlstr);
					$mynum=mysqli_num_rows($query1);
					if($mynum!=0){
						while($myrows=mysqli_fetch_assoc($query1)){
								$productID=" productID=".$myrows['ID'];
								$products_sql=$products_sql_p." and ".$productID;
								$subcateid=$myrows['ID'];
								writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid,$translate);
								$subcateid="";
						}
					}
					else{
						//中类下没有小类
						$products_sql=$products_sql_p." and productID=".$midcateid;
						writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid,$translate);
			
					}
				}
				//小类
				if($cateid!="" && $midcateid!=""&& $subcateid!=""){
					$products_sql=$products_sql_p." and productID=".$subcateid;
					writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid,$translate);
				}
				//echo 	$products_sql;
				echo "生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=products\">返回</a>";
				if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;

				echo "<br/>
				---------------------------------------------------------------------------------------------------<br/><br/><br/>";																				
				if($_GET['productsall']=="ok")//不生成全部产品就执行一次循环退出
				{}
				else{
					break;
				}
			}// end of cate while
			if($ls!="all_products"){
				// 记录结束时间
				$time_end = getmicrotime();
				$time = $time_end - $time_start;
				// 输出运行总时间 
				//echo "执行时间： $time 秒";
				//生成全部页面，不包括产品页，否则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="nomenufiles";
				$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,$languages0,$ls_addprolink,$ls_addnewprolink,$newstag,$translate,$d_cate);
			}
	
			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_motif,$ls_menu,$ls_foot,
	$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$languages0,$ls_addprolink,$ls_addnewprolink,$newstag,$translate,$d_cate);
			}
			$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_motif,$ls_menu,$ls_foot,
	$filename,$mainpart,$ls_introduction,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate,$s_p1_cate,$languages0,$ls_addprolink,$ls_addnewprolink,$newstag,$translate);
			}
			$subFolder=false;
			if($ls!="all" && $ls!="all_products"){
				//生成全部页面，不包括产品页，否则break 
				break;
			}

     //生成单页
    case "singlepage":
		$sql = "select * from ls_singlepages where enable=1";
		$list = $opendb->allRows($sql);
		echo "<br/>单页：";
		foreach($list as $v){
			$tpl = '../'.$templates_var."/".$v['static_tpl'];
			if(file_exists($tpl)){
				$arr = explode('.',$v['singlepage_name']);
				//echo $v['singlepage_name']."--";
				if($arr[1]=='html'){
					$ls_s_cate = $s_cate0;				//左侧产品类别
					$ls_d_cate = $d_cate0;				//底部菜单
					$ls_menu=$menu;				//主菜单
					$ls_classpro=$classpro;			//类别产品
					$ls_motif=$s_m_cate;
					$ls_hotpro=$hotpro;			//功能页面热点产品
					$ls_newpro=$newpro;			//功能页面新产品
					$ls_p_cate=$s_p1_cate;								//左侧产品类别;
					$ls_f_cate=get_pro_cate(0);//左侧产品类别; 8-25zhao
					// $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=mysqli_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);
					
					$code_sql="select * from ls_functioncode where enable=1 order by ID";	
					$code_query=$opendb->query($code_sql);
					while ($code_row=mysqli_fetch_array($code_query)){
						switch($code_row['codeID']){
							case "statistics":
								if($code_row['enable']){
									$statistics = $code_row['code'];
								}
							break;
							case "onlines":
								if($code_row['enable']){
									$onlines = $code_row['code'];
								}
							break;
							case "maps":
								if($code_row['enable']){
									$maps = $code_row['code'];
								}
							break;
							case "share":
								if($code_row['enable']){
									$share = $code_row['code'];
								}
							break;
							case "indexKeywords":
								if($code_row['enable']){
									$indexKeywords = $code_row['code'];
								}
							break;
							case "onlinechart":
								if($code_row['enable']){
									$onlinechart = $code_row['code'];
								}
							break;
							case "shield":
								if($code_row['enable']){
									$shield = $code_row['code'];
								}
							break;
						}
					}
					
					$handle = fopen($tpl,'r');
					$content = fread($handle,filesize ($tpl));
					
					$content = str_replace("{ls_statistics}",$statistics,$content); //统计代码
					$content = str_replace("{ls_onlines}",$onlines,$content);  //在线联系(QQ)
					$content = str_replace("{ls_maps}",$maps,$content);  //地图代码
					$content = str_replace("{ls_share}",$share,$content);  //分享代码
					$content = str_replace("{ls_onlinechart}",$onlinechart,$content);  //在线联系
					$content = str_replace("{ls_shield}",$shield,$content);  //首页屏蔽
					
					$content = str_replace("{ls_title}",$v['pageTitle'],$content);
					$content = str_replace("../","",$content);
					$content = str_replace("{ls_keywords}",$ls_keywords,$content);
					$ls_lineno=__LINE__.(__FUNCTION__==""?"":"， 函数：".__FUNCTION__).(__CLASS__==""?"":"， 类：".__CLASS__);

					$content = str_replace("{ls_description}",substr(strip_tags($v['pageText']),0,150),$content);
					//$ menu_pro P -> $ ls_menu T -> { ls_menu} T
					$content = str_replace("{ls_menu}",$ls_menu,$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); //搜索框
					$ls_indicatebar = "<li><a href=\"../index.html\">".$lan['home']."</a></li>
					<li style='text-transform : capitalize;'> ".strtolower($v['pageTitle'])." </li>";
					$content = str_replace("{ls_indicatebar}",$ls_indicatebar,$content);

					$content = str_replace("{singlepage_title}",$v['pageTitle'],$content);
					$singletext=str_replace("../", "",$v['pageText']);
					$singletext=replmactext($singletext);
					 
					$content = str_replace("{singlepage_content}",$singletext,$content);
					$ls_weburl1=  $_SERVER['HTTP_HOST']."/".$v['singlepage_name']; // 非80端口，会输出端口				
					$nybnstr=$v['banner']!=""?$v['banner']:str_replace(".html","",$v['singlepage_name']); //主题图banner 为空，则为images下 不带_banner.jpg

					$ls_url="";
					include("inc/_inc_allrepltags.php");
					$content = str_replace("{ls_s_cate}",$ls_s_cate,$content);
					$content = str_replace("{ls_d_cate}",$ls_d_cate,$content);
					fclose($handle);
					
					if($translate != ''){
						//翻译代码
						$folder_name = $translate;
						$r_name = deep_in_array($folder_name, $translate_name);
				
						$translateFile = "../".$r_name['folder_name'];
						createFolder($translateFile);
						createFolder("../".$r_name['folder_name']."/".$showFolders);
						$transFile = $v['singlepage_name'];
						if(translateApp($content, $translateFile."/".$transFile, $r_name['translate_name'])){
							echo "创建<a href='".$translateFile."/".$transFile."'  target='_blank'>".$translateFile."/".$transFile."</a>成功！<a href=\"temp.php?ls=normal\">返回</a>";
							if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;

							echo "<br/><br/>";
						}else{
							if($ls_debug) echo "生成文件".$translateFile."/".$transFile."失败！<br>";
						}
						
					}else{
						
						//英文网站去除<translate>标签
						$translate_str = $content;
						$p = "%<translate>(.*?)</translate>%si";    //正则表达式
						preg_match_all($p, $content, $arr);
						$temarr = $arr[1];
						
						$source="en";
						$targets = $target;
					
						foreach($temarr as $val){
							$content = str_replace("<translate>".$val."</translate>", $val, $content);
						}
						include("inc/_inc_when_write_file.php");
						
						$handle = fopen('../'.$v['singlepage_name'],'w+');
						if (!is_writable ('../'.$v['singlepage_name']))
						{ 
							if($ls_debug) echo "文件："."../".$v['singlepage_name']."不可写，请检查其属性后重试！";
						}else{
							if(fwrite($handle,$content)){
								echo "<br/>生成 <a href='../".$v['singlepage_name']."'>../".$v['singlepage_name']."</a>成功，";
								if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno)."<br/>";

								fclose ($handle);
								$writeurl=$_SERVER['HTTP_HOST']."/".str_replace("..","",$v['singlepage_name']);

							}	
						}
					}
				}else{
					if($ls_debug) echo "生成的".$v['singlepage_name']."文件格式错误<br>";	
				}
			}else{
				if($ls_debug) echo "模版文件".$tpl."不存在，生成".$v['singlepage_name']."失败<br>";	
			}
		}
		echo "<br/>";
		if($ls!="all" && $ls!="all_products"){
			//生成全部页面，不包括产品页，否则break 
			break;
		}
	case "index":  //生成首页
		echo "<br/>首页：<br/>";
		$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_title=$config_row['companyName'];	//首页title $config_row['siteKeywords']." - ".
		$ls_keywords=$config_row['siteKeywords'];	//首页Keywords关键词
		$ls_description=$config_row['siteDescription'];//首页Description描述
*/		 
		$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_cate0,$s_p1_cate,$languages0,$ls_addprolink,$ls_addnewprolink,$newstag,$translate);
		
 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=mysqli_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_cate0;			//左侧产品类别
		$ld_cate=$d_cate0;			//左侧产品类别
		$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,$languages0,$ls_addprolink,$ls_addnewprolink,$newstag,$translate);
	 	 if($ls!="all" && $ls!="all_products")
 {break;}	
 
	case "feedback":  //生成 feedback
		
		$index_path="../".$templates_var."/feedback.html";	//模板地址
/*		$ls_title=$config_row['companyName'];//title
		$ls_keywords=$config_row['siteKeywords'];	//Keywords
		$ls_description=$config_row['siteDescription'];//Description
*/			//$ls_cate=$pro_cate;																						//左侧产品类别
			//$ls_menu=$menu_pro;																						//主菜单
		$ls_cate=$s_cate0;				//左侧产品类别
		$ld_cate=$d_cate0;				//
		$ls_p_cate=$s_p1_cate;
		$ls_motif=$s_m_cate;
		$ls_menu=$menu;	//主菜单
		$ls_feedback=$config_row['feedback'] ;//feedback
		$ls_feedbackemail=$config_row['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,$languages0,$ls_addprolink,$ls_addnewprolink,$newstag,$translate);

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

	 
	 case "contactus":  //生成 contact us
			
		$contactus.="Address:".$config_row['address']."<br>\n";
		$contactus.="Tel:".$config_row['tel']."<br>\n";
		$contactus.="Fax:".$config_row['fax']."<br>\n";
		$contactus.="E-Mail:<a href=\"mailto:".$config_row['email']."\">".$config_row['email']."</a><br>\n";
		$contactus.="MSN:<a href=\"mailto:".$config_row['MSN']."\">".$config_row['MSN']."</a><br>\n";
		$contactus.="URL:<a href=\"http://".$config_row['website']."\">".$config_row['website']."</a><br>\n";
		$contactus.=$ContactAttach; //联系我们的附件文字： google地图， 地区环境
		
		$contactus = $config_row['contact'];
		
		$index_path="../".$templates_var."/contact.html";//模板地址
		
		$information_sql="select * from ls_information where inMenu='contact' ";
		$information_query=$opendb->query($information_sql);
		$information_rows=mysqli_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_cate0;	//左侧产品类别
		$ld_cate=$d_cate0;	//左侧产品类别
		$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,$languages0,$ls_addprolink,$ls_addnewprolink,$newstag,$translate,$d_cate);
	 	 if($ls!="all" && $ls!="all_products")
 {break;}	

	// 文章详细页，及文章列表页：遍历所有分类 functionName cate, 按分类生成 相关分类的article index.php，如 index_all.html, index_tieshi.html
	// 文章详细页 articleshow.html
	
	case "article": //生成文章 支持 2级分类 functionName cateName
	$addcatestr=substr(str_replace(",","' or cateName='",$defaultmenu),1)."' ";

	$article_cate_sql1="select * from `ls_functioncates` where functionName!='新闻分类' and functionName!='博客分类' and functionName!='常见问题' and ( cateName='' or cateName is NULL  ".$addcatestr." )  and createpage=1 order by Num asc ";
	//echo $article_cate_sql1;
	$result_cate1=$opendb->query($article_cate_sql1); 
	$num_cate1=mysqli_num_rows($result_cate1);
	while($funcnews = mysqli_fetch_assoc($result_cate1))
	{
		$articletplfunc=trim($funcnews['typeurl']);
		
		$functionName=$funcnews['functionName'];
		$article_cate_sql2="select * from `ls_functioncates` where functionName='".$functionName."'  and !( cateName='' or cateName is NULL  ".$addcatestr." ) order by Num asc ";
		$result_cate=$opendb->query($article_cate_sql2); //
		//echo $article_cate_sql2;
		$num_cate=mysqli_num_rows($result_cate);
		echo "<br/>Func: ".$functionName."<br/>";
		if($num_cate==0){ //只有大类
			  $article_cate_sql3="select * from `ls_functioncates` where ID=".$funcnews['ID'];
			  $result_cate3=$opendb->query($article_cate_sql3);
			  $num_cate3=mysqli_num_rows($result_cate3);
			  $funcnocate = mysqli_fetch_assoc($result_cate3);
			  $articletplcate=trim($funcnocate['typeurl']);
			  $funcfolder=$funcnocate['folder'];
			  $catefilename=( $articletplcate==""?str_replace(".",$funcnocate['ID'].".",$articletplfunc):$articletplcate);
			  $cateName=$funcnocate['functionName']; // 适应 _article_list_detail.php
			  echo "<br/>Func1: ".$cateName."<br/>";;
			  
			  $article_sql2="select * from ls_article where enable=1 and functionName='".$functionName."' order by Num desc,ID desc ";
			 // echo $article_sql2;
			  $catefolder=$funcfolder; //强制到大类
			  $suffix_str2=str_replace(".html","",$funcnocate['typeurl']); 
			  $catenews=$funcnocate;	// 适应 _article_list_detail.php
			  include("widget/_article_list_detail.php");
		
				
	   }else{ //大类 和 中类
		  $i_news=1;
		  $sort='';	
		  $midocate=""; //cate列表
		  echo "<br/>";
		  $listtpl = $articletplfunc;
		  $p22_s = "%<ls_foreach_scate>(.*?)</ls_foreach_s>%si";    //侧边分类列表
		  preg_match_all($p22_s, $listtpl, $arr_s);
		  $ls_foreach_scate = $arr_s[1][0];
		  $ls_foreach_s0cate = $arr_s[0][0]; //包含
		  $ls_list_scate="";

		  while($catenews = mysqli_fetch_assoc($result_cate)) //中类
		  {
			$catefolder=trim($catenews['folder']); //与 $cateFolders 不同
			$articletplcate=trim($catenews['typeurl']);
			$catefilename=( $articletplcate==""?str_replace(".",$catenews['ID'].".",$articletplfunc):$articletplcate);
			$cateName=$catenews['cateName'];
			
			$ls_list_scate.= str_replace("{ls_list_s}",$cateName,$ls_foreach_scate); 
			
			echo "Cate: ".$cateName."<br/>";
			//$mysuffStr=$catenews['suffStr'];
			$article_sql2="select * from ls_article where enable=1 and cateName='".$cateName."' order by Num desc,  ID desc ";
			//$suffix_str2=str_replace(".html","",$articletplcate); // syscode中 $articletplfunc writeShowPages $index_newspath
			//echo $suffix_str2."--0--".$articletplfunc."<br/>";
			   
			include("widget/_article_list_detail.php");  //文章列表 及 文章详细
			
			
 			include("_article_cate_list.php"); // cate 列表页
			 
		}//end of while all article cateName

		//cate列表文件生成
		//echo $articletplfunc."-=-=";
		if($articletplfunc=="") {echo $functionName."-".$cateName." 模板文件名不存在。";continue;}
		$index_path="../".$templates_var."/".$articletplfunc;	//模板地址
		//echo $articletplfunc;
		$ls_title=$funcnews['fTitle'];						
		$ls_keywords=$funcnews['fKeywords'];
		$ls_description=$funcnews['fDescription'];
		$ls_brief=$funcnews['brief'];
		$ls_cate="<a href=\"".$articletplfunc."\" >" . $functionName."</a>";																						 
		$mainpart=$midocate ; //文章news 列表
		//echo $mainpart."-dl--";
		$mainpartsubject="article";
		$filename = "../".$articletplfunc; //如dl.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_cate0,$s_p1_cate,$languages0,$ls_addprolink,$ls_addnewprolink,$articletag,$translate,$p_cate0);
	  }// end of $num_cate!=0
	}//end of while all article functionName
		echo "共有".$mynum."条文章。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>";
		if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;
		echo "<br/><br/>";
		
		$suffix_str2=""; // 清除后缀，避免干扰
	 if($ls!="all" && $ls!="all_products")
 {break;}
 
 
	// 新闻详细页，及新闻列表页：遍历所有分类 cate, 按分类生成 相关分类的news index.php，如 index_all.html, index_tieshi.html
	// 新闻详细页 newsshow.html
	
	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=mysqli_num_rows($result_cate);
	$i_news=1;
	$sort='';	
	while($catenews = mysqli_fetch_assoc($result_cate))
	{
		 //$mido = "<h3>".$catenews['cateName']."</h3>";
		 $thisnewscate=$catenews['cateName'];
		 $mysuffStr=$catenews['suffStr'];
		 $news_sql2="select * from ls_news where enable=1 and cate='".$thisnewscate."' order by Num desc,  ID desc ";
/* 		 $suffix_str2= $mysuffStr  =="news"?"":$mysuffStr;
		 if($thisnewscate!="news" && $thisnewscate!="" && $mysuffStr==""){
			  $suffix_str2=$thisnewscate ; echo "<br/>新闻分类 $thisnewscate 的 suffStr 不存在，用类名 $thisnewscate 代替 <br/>";
		 }
*/
		 if( $mysuffStr==""){
			  $suffix_str2=$thisnewscate ; echo "<br/>新闻分类 $thisnewscate 的 suffStr 不存在，新闻文件名前缀为类名 $thisnewscate <br/>";
		 }else{
			  $suffix_str2=$mysuffStr ; echo "<br/>新闻分类 $thisnewscate 新闻文件名前缀为 $mysuffStr  <br/>";
	 
		 }
		 
		  $suffix_str2=pathProName($suffix_str2);
		 $result=$opendb->query($news_sql2);
		$mynum = mysqli_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=="news"?"":$suffix_str2);
			if($i == 0)
			{
				$suffix_str = $suffix_str;
			} 
			else 
			{
				$suffix_str = $suffix_str."-".$i;
			}
			$start = $i * $onepage;
			$propage=getPagess(($suffix_str2=="news"?"news":"news".$suffix_str2).".html",$allpages,$i+1);	 //"news".
			$news_sql=$news_sql2." limit ".$start.",".$onepage." ";
			
		$mido = "";
		$news_query=$opendb->query($news_sql);
		while($news_rows=mysqli_fetch_assoc($news_query))
		{
			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 = $newsImg.$proportion;
			}else{
				$blogimg="src=\"images/news.jpg\" width='220'";
			}
	
			 
			$srcImg = str_replace("../ls_admin/","ls_admin/",$blogimg);
			// 新闻列表页，包括   $mido -> $ ls_newslist -> $ mainpart  -> ls_syscode (writeMainMenuItemFile) $ ls_newslist -> {ls_newslist}
			$typeurl=$catenews['typeurl'];
			include("_news_list.php"); //news_list
			
			$index_newspath=$suffix_str2!="news"?"../".$templates_var."/newsshow".$suffix_str2.".html":"../".$templates_var."/newsshow.html";		//模板地址
			$newsshowtypeurl=str_replace(".html","show.html","../".$templates_var."/".$typeurl);
			$index_newspath=file_exists($newsshowtypeurl)?$newsshowtypeurl:$index_newspath;
			
			if(file_exists($index_newspath)){
			// 新闻详细页	，包括 分类新闻，tieshi,dongtai,gonggao  newsshow
				writeShowPages($news_rows, $suffix_str2, "news", "news", $menu_pro, $pro_cate, $s_pro_cate, $s_m2_cate, $ls_propage, $facebook_twitter, $s_site_cate, $foot, $ls_addprolink, $ls_addnewprolink, $ls_h1_news, $s_p_cate, $languages, get_pro_cate(1), $lan['news'], $translate, $d_pro_cate);

			}else{
				if($ls_debug) echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";	
			}
		}
		
	//end for , all pages
	
	// 新闻列表页  包括 分类新闻，tieshi,dongtai,gonggao  newsshow
		$index_path= $suffix_str2!="news"? "../".$templates_var."/news".$suffix_str2.".html":"../".$templates_var."/news.html";						  //模板地址
		//$newstypeurl="../".$templates_var."/".$typeurl;
		//$index_path=file_exists($newstypeurl)?$newstypeurl:$index_path;
		
		$ls_title=$catenews['fTitle'];												//title
		$ls_keywords=$catenews['fKeywords'];										//Keywords
		$ls_description=$catenews['fDescription'];//Description
		$ls_brief=$catenews['brief'];												//title

		$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 = $typeurl=="news.html"? "../news".$suffix_str.".html":"../".$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_cate0,$s_p1_cate,$languages0,$ls_addprolink,$ls_addnewprolink,$newstag,$translate,$d_cate0);
		}//end of while all news cats
	}
		echo "共有".$mynum."条新闻。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a>";
		if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;
		echo "<br/><br/>";
		
		$suffix_str2=""; // 清除后缀，避免干扰
	 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=mysqli_num_rows($result_cate);
	$i_news=1;
	
	
	$sort='';	
	while($catenews = mysqli_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 = mysqli_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=mysqli_fetch_assoc($news_query))
		{
			/*$mido.="<li><div class='art_title')'><span>(".date('m-d-y',strtotime($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>";*/
			
			include("_faq_list.php"); //faq_list
			
			$index_newspath="../".$templates_var."/faqshow".$suffix_str2.".html";		//模板地址
			 
			if(file_exists($index_newspath)){
				
				writeShowPages($news_rows, $suffix_str2, "faq", "news", $menu_pro, $pro_cate, $s_pro_cate, $s_m2_cate, $ls_propage, $facebook_twitter, $s_site_cate, $foot, $ls_addprolink, $ls_addnewprolink, $ls_h1_news, $s_p_cate, $languages, get_pro_cate(1), $lan['faq'], $translate, $d_pro_cate);

			}else{
				if($ls_debug) echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";
			}
		}
		
	//end for , all pages
	
		$index_path="../".$templates_var."/faq".$suffix_str2.".html";						//模板地址
		$ls_title=$config_row['companyName'];												//title
		$ls_keywords=$config_row['siteKeywords'];										//Keywords
		$ls_description=$config_row['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_cate0,$s_p1_cate,$languages0,$ls_addprolink,$ls_addnewprolink,$newstag,$translate,$d_cate0);
	}//end of while all news cats
}
  		echo "共有".$mynum."条常见问题。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>";
		if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;

		echo "<br/><br/>";
		
		$suffix_str2=""; // 清除后缀，避免干扰
	//end of while all news cats

	 if($ls!="all" && $ls!="all_products")
 {break;}
 
 case "feedback":  //生成 feedback
		
		$index_path="../".$templates_var."/feedback.html";	//模板地址
/*		$ls_title=$config_row['companyName'];//title
		$ls_keywords=$config_row['siteKeywords'];	//Keywords
		$ls_description=$config_row['siteDescription'];//Description
*/		//$ls_cate=$pro_cate;																						//左侧产品类别
		//$ls_menu=$menu_pro;																						//主菜单
		$ls_cate=$s_cate;				//左侧产品类别
		$ld_cate=$d_cate;				//
		$ls_p_cate=$s_p1_cate;
		$ls_motif=$s_m_cate;
		$ls_menu=$menu;	//主菜单
		$ls_feedback=$config_row['feedback'] ;//feedback
		$ls_feedbackemail=$config_row['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,$s_cate0,$s_p1_cate,$languages0,$ls_addprolink,$ls_addnewprolink,$newstag,$translate,$d_cate0);

	 	 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=mysqli_num_rows($result_cate);
	$catenews = mysqli_fetch_assoc($result_cate);
	$i_news=1;
	 
	
	//博客友情链接
	$links_sql = "select * from ls_links where enable = 1 and cateName = 'Blog'";
	$links_query = $opendb->query($links_sql);
	while($links_rows=mysqli_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)){
		if($translate != ''){
			$folder_name = $translate;
			$r_name = deep_in_array($folder_name, $translate_name);
			$translateFile = "../".$r_name['folder_name'];
			createFolder($translateFile."/".$blogFolders);
		}else{
			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);
		//$ menu_pro P -> $ ls_menu T -> { ls_menu} T
		$blogcontent = str_replace("{ls_menu}",$ls_menu,$blogcontent);
		$blogcontent = str_replace("{ls_cate}",$ls_cate,$blogcontent);
		$blogcontent = str_replace("{ls_s_cate}",$s_pro_cate,$blogcontent);
		$blogcontent = str_replace("{ld_cate}",$ld_cate,$blogcontent);
		$blogcontent = str_replace("{ls_d_cate}",$d_pro_cate,$blogcontent);
		$blogcontent = str_replace("{ls_p_cate}",$s_p_cate,$blogcontent);
		//   $ languages  P -> $ ls_languages T 等 -> { ls_languages}
		$blogcontent = str_replace("{ls_languages}",$languages,$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链接
		$tem_sql="select * from ls_config order by ID";	
		$tem_query=$opendb->query($tem_sql);
		$row=mysqli_fetch_array($tem_query);
		$blogcontent = str_replace("{ls_copyright}",$row['copyright'],$blogcontent);
		$blogcontent = str_replace("{ls_linkblog}",$ls_links,$blogcontent);
		$bcate = $blogcontent;
		$sort='';
		
		//博客首页不分类别输出前N条最新博客 start
		$p22 = "%<ls_foreach>(.*?)</ls_foreach>%si";    //正则表达式
		preg_match_all($p22, $bcate, $arr);
		$bloginarr = $arr[1][0];
		
		$pathshow="../".$templates_var."/blogshow.html";
		$fpshow	   = fopen ($pathshow,"r");
		$contentshow = fread ($fpshow,filesize ($pathshow));
		
		$p22_s = "%<ls_foreach_s>(.*?)</ls_foreach_s>%si";    //正则表达式
		preg_match_all($p22_s, $contentshow, $arr_s);
		$ls_foreach_s = $arr_s[1][0];
		$ls_foreach_s0 = $arr_s[0][0]; //包含
		$ls_list_s="";


		$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=mysqli_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 = $newsImg.$proportion;
			}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>":"");
			
			//if($blog_i<=$PageNumBlog)
				$ls_list_s.= str_replace("{ls_bloglist_s}",$blogtitle,$ls_foreach_s); ;
			
			$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 = mysqli_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 = mysqli_num_rows($result);//总产品数
					// 每页数量
				$onepage = $PageNumBlog;
					//共有页数
				$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));
					/*$ls_newstag = $catenews['suffStr'];*/
					$ls_newstag = $catenews['cateName'];
					$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=mysqli_fetch_assoc($news_query))
					{
						$blog_i++;
						
						include("_blog_list.php"); //blog_list
						
						$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;
						}
						
						$ls_lineno=__LINE__.(__FUNCTION__==""?"":"， 函数：".__FUNCTION__).(__CLASS__==""?"":"， 类：".__CLASS__);
						$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 = date('m-d-y',strtotime($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_d_cate=$d_pro_cate;								//
							$ls_p_cate=$s_p_cate;								//左侧产品类别;
							$ls_languages=$languages;                           //语言国旗
							$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;										//底部信息
							
					$code_sql="select * from ls_functioncode where enable=1 order by ID";	
					$code_query=$opendb->query($code_sql);
					while ($code_row=mysqli_fetch_array($code_query)){
						switch($code_row['codeID']){
							case "statistics":
								if($code_row['enable']){
									$statistics = $code_row['code'];
								}
							break;
							case "onlines":
								if($code_row['enable']){
									$onlines = $code_row['code'];
								}
							break;
							case "maps":
								if($code_row['enable']){
									$maps = $code_row['code'];
								}
							break;
							case "share":
								if($code_row['enable']){
									$share = $code_row['code'];
								}
							break;
							case "indexKeywords":
								if($code_row['enable']){
									$indexKeywords = $code_row['code'];
								}
							break;
							case "onlinechart":
								if($code_row['enable']){
									$onlinechart = $code_row['code'];
								}
							break;
							case "shield":
								if($code_row['enable']){
									$shield = $code_row['code'];
								}
							break;
						}
					}							
							$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);
							//$ menu_pro P -> $ ls_menu T -> { ls_menu} T
							$newscontent = str_replace("{ls_menu}",$ls_menu,$newscontent);
							
							//   $ languages  P -> $ ls_languages T 等 -> { ls_languages}
							$newscontent  = str_replace("{ls_statistics}",$statistics,$newscontent);
							$newscontent  = str_replace("{ls_onlines}",$onlines,$newscontent);

							$newscontent = str_replace("{ls_languages}",$ls_languages,$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\">".$lan['home']."</a></li>
											   <li style='text-transform : capitalize;'><a href=\"../news".$suffix_str2.".html\">".strtolower($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 = str_replace("{ls_copyright}",$row['copyright'],$newscontent);
							$newscontent = circleNavigationLinkNews($news_rows['ID'],'B','{ls_nextlink}',$newscontent,"ls_news",$catenews['cateName'],"blog",$suffix_str2,true);
							$newscontent = circleNavigationLinkNews($news_rows['ID'],'F','{ls_previouslink}',$newscontent,"ls_news",$catenews['cateName'],"blog",$suffix_str2,true);
							
							$newscontent = str_replace("{newstag}",$newstag,$newscontent);
							$linksblog_sql = "select * from ls_links where enable = 1 and cateName = 'Blog'";
							$linksblog_query = $opendb->query($linksblog_sql);
							while($linksblog_rows=mysqli_fetch_assoc($linksblog_query)){
							$linksblog_str .= "<li><a href ='".$linkblogs_rows['linkURL']."' target='_blank'>".$linksblog_rows['linkTitle']."</a></li>";
		}
							$ls_linkblog = $linksblog_str;							
							$newscontent = str_replace("{ls_linkblog}",$ls_linkblog,$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";
							$content=$newscontent;
							$ls_weburl1=  $_SERVER['HTTP_HOST'].str_replace("..","",$filename); // 非80端口，会输出端口
							include("inc/_inc_allrepltags.php"); 
							$newscontent=$content;
							$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);

							if($translate != ''){
								//翻译代码
								$folder_name = $translate;
								$r_name = deep_in_array($folder_name, $translate_name);
						
								$translateFile = "../".$r_name['folder_name'];
								createFolder($translateFile);
								$transFile = str_replace("../", "", $filename);
								if(translateApp($newscontent, $translateFile."/".$transFile, $r_name['translate_name'])){
									echo "创建 <a href='".$translateFile."/".$transFile."'  target='_blank'>".$translateFile."/".$transFile."</a>成功！<a href=\"temp.php?ls=normal\">返回</a>";
									if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;
									echo "<br/><br/>";

									
								}else{
									if($ls_debug) echo "生成文件".$translateFile."/".$transFile."失败！<br>";
								}
							}else{
								if (is_file ($filename)){ 
									 @unlink ($filename); //若文件已存在，则删除
								}
								//英文网站去除<translate>标签
								$translate_str = $newscontent;
								$p = "%<translate>(.*?)</translate>%si";    //正则表达式
								preg_match_all($p, $newscontent, $arr2);
								$temarr2 = $arr2[1];
								
								$source="en";
								$targets = $target;
							
								foreach($temarr2 as $val2){
									$newscontent = str_replace("<translate>".$val2."</translate>", $val2, $newscontent);
								}
							   $handle   = fopen ($filename,"w"); //打开文件指针，
									/*
									检查文件是否被创建且可写
									 */
										 
								if (!is_writable ($filename)){ 
									 if($ls_debug) echo "<script>alert('文件：".$filename."不可写，请检查其属性后重试！');history.go(-1);</script>";
								}
								if (!fwrite ($handle,$newscontent)){  //将信息写入文件
									if($ls_debug) echo "'生成文件".$filename."失败！";
								 } 
								 else
								 {
										 $writeurl=$_SERVER['HTTP_HOST']."/".str_replace("..","",$filename);

										 include("inc/_inc_when_write_file.php");
	 
								}
								fclose ($handle); //关闭指针
								 //echo "创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\">返回</a><br/><br/>";
							}
							fclose ($fp);
						}else{
							if($ls_debug) echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";
						}
					}
					echo "共有".$mynum."条博客。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>";
					if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;
					echo "<br/><br/>";
				}else{
					if($ls_debug) echo "<p>模版文件".$index_path."不存在，请设计好模板后重新生成。</p>";
				}
				
				$blog123 = str_replace("<ls_foreach>".$blogarr."</ls_foreach>", $blogindex, $cate_val);
				
/*				$ls_title=$config_row['companyName'];												//title
				$ls_keywords=$config_row['siteKeywords'];										//Keywords
				$ls_description=$config_row['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_pro_cate,$s_p_cate,$languages,$ls_addprolink,$ls_addnewprolink,$ls_newstag,$translate);
			}//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);
		}
		
		$blogcontent  = str_replace("{ls_statistics}",$statistics,$blogcontent);
		$blogcontent  = str_replace("{ls_onlines}",$onlines,$blogcontent);

		$filename="../".$blogFolders."/index.html";
		$content=$blogcontent;
		$ls_weburl1=  $_SERVER['HTTP_HOST'].str_replace("..","",$filename); // 非80端口，会输出端口
		include("inc/_inc_allrepltags.php");
		$blogcontent=$content;

				
		if (is_file ($filename))
		{ 
			 @unlink ($filename); //若文件已存在，则删除
		}
		
		if($translate != ''){
			//翻译代码
			$folder_name = $translate;
			$r_name = deep_in_array($folder_name, $translate_name);
	
			$translateFile = "../".$r_name['folder_name'];
			createFolder($translateFile);
			$transFile = str_replace("../", "", $filename);
			if(translateApp($blogcontent, $translateFile."/".$transFile, $r_name['translate_name'])){
				echo "创建 <a href='".$translateFile."/".$transFile."'  target='_blank'>".$translateFile."/".$transFile."</a>成功！<a href=\"temp.php?ls=normal\">返回</a>";
				if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;
				echo "<br/><br/>";

			}else{
				if($ls_debug) echo "生成文件".$translateFile."/".$transFile."失败！<br>";
			}
		}else{
			//英文网站去除<translate>标签
			$translate_str = $blogcontent;
			$p = "%<translate>(.*?)</translate>%si";    //正则表达式
			preg_match_all($p, $blogcontent, $arr);
			$temarr = $arr[1];
			
			$source="en";
			$targets = $target;
		
			foreach($temarr as $val){
				$blogcontent = str_replace("<translate>".$val."</translate>", $val, $blogcontent);
			}
		   $handle   = fopen ($filename,"w"); //打开文件指针，
				/*
				检查文件是否被创建且可写
				 */
			if (!is_writable ($filename)){ 
				 if($ls_debug) echo "<script>alert('文件：".$filename."不可写，请检查其属性后重试！');history.go(-1);</script>";
				 if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;

			}
			
			if (!fwrite ($handle,$blogcontent)){  //将信息写入文件
				if($ls_debug) echo "生成文件".$filename."失败！";
				if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;

			 } 
			 else
			 {
				 if($ls_debug) echo "生成文件".$filename."成功！";
				if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;
				 $writeurl=$_SERVER['HTTP_HOST']."/".str_replace("..","",$filename);
				 include("inc/_inc_when_write_file.php");

				 
			}
			 
			  
			fclose ($handle); //关闭指针
			 //echo "创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\">返回</a><br/><br/>";
		}
		fclose ($fp);
	}else{
		if($ls_debug) echo "<p>模版文件".$blog_path."不存在，请设计好模板后重新生成。</p>";
		if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;

	}
	echo "<br><br>";
	$suffix_str2=""; // 清除后缀，避免干扰
	 if($ls!="all" && $ls!="all_products")
 {break;}
	 
	case "download": //生成下载
		$news_sql2="select * from ls_download where enable=1 order by Num desc ";
	  	$result=$opendb->query($news_sql2);
		$mynum = mysqli_num_rows($result);//总产品数
		// 每页数量
		$onepage = $PageNumDowbloads; 
		//共有页数
		$allpages = ceil($mynum/$onepage);
		
		//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			
		for ($i=0; $i<= $allpages; $i++)
		{ 
			if ($i == 0)
			{ 
			$indexpath = "download.html";
		  	} 
		  	else 
		  	{ 
				$indexpath = "download-".$i.".html";
		  	}
			 $start = $i * $onepage;
			 $mido=""; 
			//页码计算
			$propage=getPagess("download.html",$allpages,$i+1);
			//页码计算
		 //查询产品
		 
		 $news_sql=$news_sql2. " limit ".$start.",".$onepage." ";
		// echo $news_sql;
			 $news_query=$opendb->query($news_sql);
	
			 while($news_rows=mysqli_fetch_assoc($news_query))
			{
				include("_download_list.php"); //download_list
			}
				$index_path="../".$templates_var."/download.html";		  //模板地址
/*				$ls_title=$config_row['companyName'];				//title
				$ls_keywords=$config_row['siteKeywords'];			//Keywords
				$ls_description=$config_row['siteDescription'];	//Description
*/				$ls_cate=$cate;																								//左侧产品类别
				$ls_motif=$s_m_cate;
				$ls_menu=$menu;																								//主菜单
				$ls_downlist=$mido ;	// $downlist																	//新闻news 列表
				$ls_propage=$propage;																					//新闻分页页码
				$ls_foot=$foot;																								//底部信息
				
		$ls_feedbackemail="";
		$mainpart=$ls_downlist;
		$mainpartsubject="download";
		$filename = "../".$indexpath;
		if($mynum!=0) 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_cate0,$s_p1_cate,$languages0,$ls_addprolink,$ls_addnewprolink,$newstag,$translate,$d_cate0);

		}
	
	  		
	  	echo "共有".$mynum."条下载。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>";
		if($mynum==0) echo "<br>不生成download.html页。<br>";
		if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;
		echo "<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=mysqli_fetch_assoc($news_query3);
		$introduction = $news_rows3['description'];
		$introduction =  str_replace("../", "", $introduction);
		
		$news_sql2="select * from ls_management where enable=1 order by Num desc ";
		$result=$opendb->query($news_sql2);
		$mynum = mysqli_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_management where enable=1 order by Num desc ";
			if ($i == 0){ 
				$indexpath = "management.html";
			}else{ 
				$indexpath = "management-".$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="<div class=\"p_list\">";
			while($news_rows=mysqli_fetch_assoc($news_query)){
				
				include("_management_list.php");//	management_list
				
				$index_newspath="../".$templates_var."/managementshow.html";		//模板地址
				if(file_exists($index_newspath)){
					
					writeShowPages($news_rows, $suffix_str2, "management", "management", $menu_pro, $pro_cate, $s_pro_cate, $s_m2_cate, $ls_propage, $facebook_twitter, $s_site_cate, $foot, $ls_addprolink, $ls_addnewprolink, $ls_h1_news, $s_p_cate, $languages, get_pro_cate(1), $lan['management'], $translate, $d_pro_cate);
					
				}else{
					if($ls_debug) echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";
					if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;

				}
			}
			$list.="</div>";
			
			//页码计算
			$propage=getPagess("management.html",$allpages,$ls_current_page);
			
			$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 ;										//车间图片列表
			$ls_introduction=$introduction;                           //车间简介
			$ls_propage=$propage;									//车间分页页码
			$ls_foot=$foot;											//底部信息
			
			$ls_feedbackemail="";
			$mainpart=$ls_list;
			$mainpartsubject="management";
			$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_cate0,$s_p1_cate,$languages0,$ls_addprolink,$ls_addnewprolink,$newstag,$translate,$d_cate0);
		}
		
	  	echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>";
		if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;
		echo "<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=mysqli_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 = mysqli_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="<div class=\"row pro_list\">";
				while($news_rows=mysqli_fetch_assoc($news_query)){
					
					include("_workshop_list.php"); //workshop_list

					$index_newspath="../".$templates_var."/workshopshow.html";		//模板地址
					if(file_exists($index_newspath)){
						
						writeShowPages($news_rows, $suffix_str2, "workshop", "workshop", $menu_pro, $pro_cate, $s_pro_cate, $s_m2_cate, $ls_propage, $facebook_twitter, $s_site_cate, $foot, $ls_addprolink, $ls_addnewprolink, $ls_h1_news, $s_p_cate, $languages, get_pro_cate(1), $lan['workshop'],  $translate, $d_pro_cate);
						
	
					}else{
						if($ls_debug) echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";
						if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;
						echo  "<br/>";

					}
				}
				$list.="</div>";

				//页码计算
				$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_cate0,$s_p1_cate,$languages0,$ls_addprolink,$ls_addnewprolink,$newstag,$translate,$d_cate0);
			}
											
	  		echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>";
			if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;
			echo "<br/><br/>";
		
		 if($ls!="all" && $ls!="all_products")
 {break;}
		
		case "video": //生成视频(Video)
			echo "<br/>视频，媒体：<br/><br/>";
			$news_sql3="select * from ls_menu where menuName='video'";
			$news_query3=$opendb->query($news_sql3);
			$news_rows3=mysqli_fetch_assoc($news_query3);
			$introduction = $news_rows3['description'];

			$pathshow="../".$templates_var."/".$ls."show.html";
			$fpshow	   = fopen ($pathshow,"r");
			$contentshow = fread ($fpshow,filesize ($pathshow));
			
			$p22_s = "%<ls_foreach_s>(.*?)</ls_foreach_s>%si";    //正则表达式
			preg_match_all($p22_s, $contentshow, $arr_s);
			$ls_foreach_s = $arr_s[1][0];
			$ls_foreach_s0 = $arr_s[0][0];
			$ls_list_s="";
			$j=1;

			$news_sql2="select distinct cateName from ls_video where enable=1 order by Num desc ";
	 		$result1=$opendb->query($news_sql2);
			while($cate_rows=mysqli_fetch_assoc($result1)){	
				$mycateName=$cate_rows['cateName'];
				$videotpl=$mycateName.".html";
				$index_path="../".$templates_var."/".$videotpl;	//无caeName模板地址，用video.html
				if(!file_exists($index_path))$index_path="../".$templates_var."/video.html";
			
				$news_sql2="select * from ls_video where cateName='".$mycateName."' and enable=1 order by Num desc ";
				$result=$opendb->query($news_sql2);
				$mynum = mysqli_num_rows($result);//总产品数
				// 每页数量
				$onepage = $PageNum; 
				//共有页数
				$allpages = ceil($mynum/$onepage);
	
				echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
				
	
				//根据页码生成文件名
				for ($i=0; $i<= $allpages; $i++){
					$news_sql2="select * from ls_video where cateName='".$mycateName."' and enable=1 order by Num desc ";
					if ($i == 0){ 
						$indexpath = $videotpl; //"video.html"
					}else{ 
						$indexpath =str_replace(".","-".$i.".",$videotpl); // "video".$i.".html"
					}
					$start = $i * $onepage;
					
					if($allpages!=1){
						$ls_current_page=$i+1;		//当前页码
					}
					
					//页码计算
					//$propage=getPagess($videotpl,$allpages,$ls_current_page); //"workshop.html"
	
					//查询产品
					$news_sql2.=" limit ".$start.",".$onepage." ";
					$news_query=$opendb->query($news_sql2);
					
					if("192.168.2.20"==$_SERVER["SERVER_ADDR"]||$_SERVER['SERVER_ADDR']=="::192.168.2.20" || "pmf.lanscend.cn"==$_SERVER['HTTP_HOST']){
						$url=explode("/", $_SERVER["REQUEST_URI"]);
						$path = "/".$url[1];
					}else{
						$url="";
					}
					
					
					//页码计算
					$propage=getPagess($videotpl,$allpages,$ls_current_page); //"video.html"
					
					$cate_rows=funcvideorow($cateName); //分类库视频某一行
					$ls_title=$cate_rows['fTitle'];					//title
					$ls_keywords=$cate_rows['fKeywords'];				//Keywords
					$ls_description=$cate_rows['fDescription'];		//Description
					$ls_cate=$mycateName;		//左侧产品类别 $cate
					$ls_motif=$s_m_cate;
					$ls_menu=$menu;											//主菜单
					$ls_introduction=$introduction;                           //车间简介
					$ls_propage=$propage;									//车间分页页码
					$ls_foot=$foot;											//底部信息
					
					if($j<=$onepage)$ls_list_s.= str_replace("{ls_list_s}",$ls_title,$ls_foreach_s); $j++;
					
					$ls_feedbackemail="";
					$mainpartsubject="video";
					$filename = "../{$indexpath}";
					
					include("_video_list.php");  //video_list
					$ls_list=$list ;										//车间图片列表
					$mainpart=$ls_list;
				
					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_cate0,$s_p1_cate,$languages0,$ls_addprolink,$ls_addnewprolink,$newstag,$translate);
				}
				
				echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>";
				if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;
				echo "<br/><br/>";
		 } //cate while
		 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=mysqli_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 = mysqli_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="<div class=\"p_list\">";
				while($news_rows=mysqli_fetch_assoc($news_query)){
					
					include("_quality_list.php");  //quality_list
				
					$index_newspath="../".$templates_var."/qualityshow.html";		//模板地址
					if(file_exists($index_newspath)){
						
						writeShowPages($news_rows, $suffix_str2, "quality", "qualitycontrol", $menu_pro, $pro_cate, $s_pro_cate, $s_m2_cate, $ls_propage, $facebook_twitter, $s_site_cate, $foot, $ls_addprolink, $ls_addnewprolink, $ls_h1_news, $s_p_cate, $languages, get_pro_cate(1), $lan['quality'], $translate, $d_pro_cate);
						
					}else{
						if($ls_debug) echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";
					}
				}
				$list.="</div>";
				
				//页码计算
				$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_cate0,$s_p1_cate,$languages0,$ls_addprolink,$ls_addnewprolink,$newstag,$translate,$d_cate0);
			}
	  		
	  		echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>";
			if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;
			echo "<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=mysqli_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 = mysqli_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=mysqli_fetch_assoc($news_query)){
					$list.="
					<li><a href=\"".$rdFolders."/rd".$news_rows['ID'].".html\" title=\"<translate>{$news_rows['Title']}</translate>\">
							<img src=\"".$rdFolders."/".$SmallFoldersProducts."/".$news_rows['Pic']."\" border=\"0\">
							</a><br /><span><translate>".$news_rows['Title']."</translate></span></li>";

					$index_newspath="../".$templates_var."/rdshow.html";		//模板地址
					if(file_exists($index_newspath)){
						
						writeShowPages($news_rows, $suffix_str2, "rd", "rd", $menu_pro, $pro_cate, $s_pro_cate, $s_m2_cate, $ls_propage, $facebook_twitter, $s_site_cate, $foot, $ls_addprolink, $ls_addnewprolink, $ls_h1_news, $s_p_cate, $languages, get_pro_cate(1), $lan['rd'], $translate,$s_pro_cate);
						
					}else{
						if($ls_debug) 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_cate0,$s_p1_cate,$languages0,$ls_addprolink,$ls_addnewprolink,$newstag,$translate,$d_cate0);

				}
	  		
	  		echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>";
			if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;

			echo "<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=mysqli_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 = mysqli_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_languages = $languages;
			$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=mysqli_fetch_assoc($news_query)){
					include("_certificates_list.php"); //_certificates_list.php
					$index_newspath="../".$templates_var."/certificateshow.html";		//模板地址
					if(file_exists($index_newspath)){
						writeShowPages($news_rows, $suffix_str2, "certificate", "certificate", $menu_pro, $pro_cate, $s_pro_cate, $s_m2_cate, $ls_propage, $facebook_twitter, $s_site_cate, $foot, $ls_addprolink, $ls_addnewprolink, $ls_h1_news, $s_p_cate, $languages, get_pro_cate(1), $lan['certificate'], $translate, $d_pro_cate);
					}else{
						if($ls_debug) 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_cate0,$s_p1_cate,$languages0,$ls_addprolink,$ls_addnewprolink,$newstag,$translate,$d_cate0);
		}
	  	echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>";
		if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;

		echo "<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=mysqli_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 = mysqli_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;								//左侧产品类别;
				$ls_languages = $languages;
		 		//查询产品
				$news_sql2.=" limit ".$start.",".$onepage." ";
				$news_query=$opendb->query($news_sql2);
				$list="<div class=\"row pro_list\">";
				while($news_rows=mysqli_fetch_assoc($news_query)){
					
					include("_packing_list.php"); //packing_list
				
					$index_newspath="../".$templates_var."/packingshow.html";		//模板地址
					if(file_exists($index_newspath)){
						writeShowPages($news_rows, $suffix_str2, "packing", "packing", $menu_pro, $pro_cate, $s_pro_cate, $s_m2_cate, $ls_propage, $facebook_twitter, $s_site_cate, $foot, $ls_addprolink, $ls_addnewprolink, $ls_h1_news, $s_p_cate, $languages, get_pro_cate(1), $lan['packing'], $translate, $d_pro_cate);
					}else{
						if($ls_debug) 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_cate0,$s_p1_cate,$languages0,$ls_addprolink,$ls_addnewprolink,$newstag,$translate,$d_cate0);
			}
	  		
	  		echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>";
			
			if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;

			echo "<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);
			//mysqli_query("set names utf8");
			$news_rows3=mysqli_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);
			//mysqli_query("set names utf8");
			$mynum = mysqli_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);
				//mysqli_query("set names utf8");
				$list="<div class=\"row pro_list\">";
				while($news_rows=mysqli_fetch_assoc($news_query)){
					include("_brand_list.php"); // 
					$index_newspath="../".$templates_var."/brandshow.html";		//模板地址
					if(file_exists($index_newspath)){
						writeShowPages($news_rows, $suffix_str2, "brand", "brand", $menu_pro, $pro_cate, $s_pro_cate, $s_m2_cate, $ls_propage, $facebook_twitter, $s_site_cate, $foot, $ls_addprolink, $ls_addnewprolink, $ls_h1_news, $s_p_cate, $languages, get_pro_cate(1), $lan['brand'], $translate,$s_pro_cate);
					}else{
						if($ls_debug) echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";
					}
				}
				$list.="</div>";
				
				//页码计算
				$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_cate0,$s_p1_cate,$languages0,$ls_addprolink,$ls_addnewprolink,$newstag,$translate,$d_cate0);
			}
	  		
	  		echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>";
			if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;

			
			echo "<br/><br/>";
		
		 if($ls!="all" && $ls!="all_products")
 		{break;}
 		
 		case "history": //生成公司历史(history)
		  $news_sql3="select * from ls_menu where menuName='history'";
			$news_query3=$opendb->query($news_sql3);
			//mysqli_query("set names utf8");
			$news_rows3=mysqli_fetch_assoc($news_query3);
			$introduction = $news_rows3['description'];
			$introduction =  str_replace("../", "", $introduction);
		
			$news_sql2="select * from ls_history where enable=1 order by Num desc ";
	 		$result=$opendb->query($news_sql2);
			//mysqli_query("set names utf8");
			
			
			$index_path="../".$templates_var."/history.html";				//车间模板地址
			if(file_exists($index_path)){
				$fp	   = fopen ($index_path,"r");
				$historycontent = fread ($fp,filesize ($index_path));
				
			$p2 = "%<ls_foreach>(.*?)</ls_foreach>%si";    //正则表达式
			preg_match_all($p2, $historycontent, $arr);
			$historyarr = $arr[1][0];
			
			$mynum = mysqli_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_history where enable=1 order by Num desc ";
				if ($i == 0){ 
					$indexpath = "history.html";
		 		}else{ 
					$indexpath = "history-".$i.".html";
		 		}
				$start = $i * $onepage;
				
				if($allpages!=1){
					$ls_current_page=$i+1;		//当前页码
				}

		 		//查询产品
				$news_sql2.=" limit ".$start.",".$onepage." ";
				$news_query=$opendb->query($news_sql2);
				//mysqli_query("set names utf8");
				$list = "";
				$historymido = "";
				while($news_rows=mysqli_fetch_assoc($news_query)){
					  
					  	include("_history_list.php");  //history_list
					  
						$historystr = str_replace("{lsf_yr}",$historyyr,$historyarr);
						$historystr = str_replace("{lsf_title}",$historytitle,$historystr);
						$historystr = str_replace("{lsf_biref}",$historybiref,$historystr);
						$historystr = str_replace("{lsf_img}",$historyimg,$historystr);
					  $historymido .= $historystr;

				}
				$list = str_replace("../", "", $historymido);
				//页码计算
				$propage=getPagess("history.html",$allpages,$ls_current_page);
				
				
				$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="history";
				$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_cate0,$s_p1_cate,$languages0,$ls_addprolink,$ls_addnewprolink,$newstag,$translate,$d_cate0);
			}
			
			}else{
				if($ls_debug) echo "<p>模版文件".$index_path."不存在，请设计好模板后重新生成。</p>";
			}
	  		
	  		echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\">返回</a>";
			
			if($ls_debug) echo " - - -  - - - ".basename($_SERVER['PHP_SELF'])." ， 行号： ".($ls_lineno==""?__LINE__:$ls_lineno) ;

			echo "<br/><br/>";
		
		 if($ls!="all" && $ls!="all_products")
 		{break;}
	
	case "test": //生成测试(Test)
			$index_path="../".$templates_var."/test.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="../test.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_cate0,$s_p1_cate,$languages0,$ls_addprolink,$ls_addnewprolink,$newstag,$translate,$d_cate0);
			
		if($ls=="all" && $ls!="all_products")
		{break;}
	 
		if($ls=="all_products"){
			break;
		}
	}
}
//				if($promlv>1)include("ls_xmlsitmap.php");
				$time_end = getmicrotime();
				$time = $time_end - $time_start;

				echo "执行时间： ".round($time,2)." 秒<br/>";
				echo "查询快表：".$_SESSION['transfast']." 次，";  //快表
				echo " ".$_SESSION['transfastTotal']." 字节<br/>";   //快表字数
				echo "查询慢表：".$_SESSION['transslow']." 次，";  //慢表 
				echo " ".$_SESSION['transslowTotal']." 字节<br/>";  //慢表字数
				
//网站页面生成结束				

?></td>
      </tr>
    </table></td>
  </tr>
  <tr  bgcolor="#f0f0ee">
    <td height="20" align="right" valign="top" style="padding-right:90px"><a href="<?=$_SERVER["HTTP_REFERER"]?>">返回 </a><br /></td>
  </tr>
</table>
</body>
</html>
