<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="css/admin.css" rel="stylesheet" type="text/css">
<title>无标题文档</title>
</head>
<body>
<table width="96%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#6396d6">
  <tr>
	<td height="18" background="images/admin_bg.gif"><div align="center"><font color="#ffffff"><strong>模板管理</strong></font></div></td>
  </tr>
  <tr>
	<td height="213" valign="top" bgcolor="#dee7ff"><br>
	  <table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
		<tr bgcolor="#B9DAFF">
		  <td style="padding-left:10px;" ><?php
	require_once('inc/conn.php');
	require_once('inc/constant.php');
	require_once('inc/ls_syscode.php');
	require_once('inc/public.php'); //main menu & left menu
	

	$ls=$_GET['ls'];
	$cateid=$_GET['cateid'];
	$cateFolders=$_GET['cateFolders'];
	$midcateid=$_GET['midcateid'];
	$midcateFolders=$_GET['midcateFolders'];
	$subcateid=$_GET['subcateid'];
	$subcateFolders=$_GET['subcateFolders'];

	//主菜单 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);
	$row=mysql_fetch_array($tem_query);
	$templates_var = $row['templates'];
	echo $templates_var;
	
	//首页新闻列表 Statt
	$news_sql="select * from ls_news order by ID desc limit 0,".$newsNum."";	
	$news_query=$opendb->query($news_sql);
	$i=1;
	while($news_rows=mysql_fetch_assoc($news_query))
	{
		$news.="<div style=\"padding-left:5px;\"><img src='Templates/images/news.gif' border='0'><a href=\"".$newsshowFolders."/news".$news_rows['ID'].".html\">".$news_rows['newsTitle']."</a>";
		$news.="<div class=\"xuxian\"></div></div>";
		if($i==$newsNum)
		{
		$news.="<div align=\"right\"><a href=\"news.html\">more..</a></div>";
		}
		
		$i++;
	}
	//新闻列表 End
	
	//首页产品展示 Start
	$products_sql="select * from ls_products where 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 showOnHome=1 and enable=1";
	$products_sql.=" order by Num desc limit 0,".$proNum." ";
	$products_query=$opendb->query($products_sql);
	while($products_rows=mysql_fetch_assoc($products_query))
	{
		$profile=getproductfolder($products_rows['productID']);
		$prosrc=$profile."/".$SmallFoldersProducts."/".$products_rows['productPic'];
		$prolink=$profile."/".$showproductsFolders."/".trim(str_replace(substr($products_rows['productPic'],-4),"",$products_rows['productPic'])).".html";


		$hotpro.="<div class=\"hotpro2\">";
		$hotpro.="<div class=\"hotpro\" >";
		$hotpro.="<a href=\"".$prolink."\" target=\"_ablank\"><img src=".$prosrc." border=\"0\" alt=\"".$products_rows['productName']."\"></a>";
		$hotpro.="</div>";
		$hotpro.="<div class=\"hotpro3\" ><a href=\"".$prolink."\">".$products_rows['productName']."</a></div>";
		$hotpro.="</div>";
		
	}																		
	//首页产品展示 End
	
	
	$about=substr_cut($config_rows['aboutus'],$aboutLength)." &nbsp;(<a href=\"aboutus.html\"> and more..</a>)";
	$allabout=$config_rows['aboutus'];
	
	switch ($ls)
	{

 case "products":  //生成产品页 products
 
 	$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 desc";
	$cate_query=$opendb->query($cate_sql);
	while($cate_rows=mysql_fetch_assoc($cate_query))
	{
		if($_GET['productsall']=="ok")
		{$cateid=$cate_rows['ID'];}
		$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 ";
			//大类
		if( $cateid!="" && $midcateid=="" && $subcateid=="" )
		{
			//大类下有中类
			$sqlstr1="select ID from ls_products where midcateID =".$cateid." ";
			$query1=$opendb->query($sqlstr1);
			$mynum1=mysql_num_rows($query1);
			if($mynum1!=0)//有中类
			{
				while($myrows1=mysql_fetch_assoc($query1))
				{
					$sqlstr2="select ID from ls_products where subcateID =".$myrows1['ID']." ";
					$query2=$opendb->query($sqlstr2);
					$mynum2=mysql_num_rows($query2);
					if($mynum2!=0) //有小类
					{
						while($myrows2=mysql_fetch_assoc($query2))
						{
							$productID=" productID=".$myrows2['ID'];
							$products_sql=$products_sql_p." and ".$productID;
							$midcateid=$myrows1['ID'];
							$subcateid=$myrows2['ID'];
							writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid);
							$midcateid="";
							$subcateid="";
						}
					}
					else //没有小类
					{							

						$productID=" productID=".$myrows1['ID'];
						$products_sql=$products_sql_p." and ".$productID;
						$midcateid=$myrows1['ID'];
						writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid);
						$midcateid="";
					}
				}

			}
			else
			{
				$products_sql=$products_sql_p." and productID=".$cateid;
				writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid);
			}
		}

		
		//中类
			if($cateid!="" && $midcateid!="" && $subcateid=="")
			{
			//中类下有小类
			$sqlstr="select ID from ls_products where subcateID =".$midcateid." ";
			$query1=$opendb->query($sqlstr);
			$mynum=mysql_num_rows($query1);
			if($mynum!=0)
			{
				while($myrows=mysql_fetch_assoc($query1))
				{
						$productID=" productID=".$myrows['ID'];
						$products_sql=$products_sql_p." and ".$productID;
						$subcateid=$myrows['ID'];
						writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid);
						$subcateid="";
				}
			}
			else
			{//中类下没有小类
				$products_sql=$products_sql_p." and productID=".$midcateid;
				writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid);

			}
		}
																					

																					
			//小类
			if($cateid!="" && $midcateid!=""&& $subcateid!="")
			{
				$products_sql=$products_sql_p." and productID=".$subcateid;
				writeProPageIndex($products_sql,$cateid,$midcateid,$subcateid);
			}
			//echo 	$products_sql;
				echo "生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=products\"><u>返回</u></a><br/>
				----------------------------------------------------------------------------------------------------<br/><br/><br/>";																				
												
		if($_GET['productsall']=="ok")//不生成全部产品就执行一次循环退出
		{}
		else
		{break;}


	}// end of cate while																													
	 
   break;

	case "all"://生成全部页面，不包括产品页 
	case "nomenufiles":  //生成首页
		$ls_cate=$cate;				//左侧产品类别
		$ls_menu=$menu;				//主菜单
		// $ls_title, $ls_keywords, $ls_description from public
		$ls_foot=$foot;				//底部信息
		foreach($generalCreateFiles as $createdfile ) {
			$index_path="../".$templates_var."/";//模板目录
			$mainpartsubject="createdfile";
			$filename="../".$createdfile;
			$index_path=$index_path.$createdfile;
			$mainpart="";
			$ls_feedbackemail="";
			$ls_propage="";
			writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_menu,$ls_foot,
$filename,$mainpart,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate);
		}

 if($ls!="all")//生成全部页面，不包括产品页，否则break 
 {break;}

	case "index":  //生成首页
		$index_path="../".$templates_var."/index.html";//首页模板地址
		$ls_cate=$cate;				//左侧产品类别
		$ls_menu=$menu;				//主菜单
		$ls_about=$about ;			//globle 首页About us 
		$ls_news=$news;				//globle 首页News
		$ls_hotpro=$hotpro;			//globle 首页Hot products
		// $ls_title, $ls_keywords, $ls_description from public
		$ls_foot=$foot;				//底部信息
		$mainpartsubject="index";
		$filename="../index.html";

		writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_menu,$ls_foot,
$filename,$mainpart,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate);

 if($ls!="all")//生成全部页面，不包括产品页，否则break 
 {break;}
 	
   case "aboutus":  //生成 About us
			
		$index_path="../".$templates_var."/aboutus.html";	//模板地址
		$ls_title=$config_rows['companyName'];//title
		$ls_keywords=$config_rows['siteKeywords'];	//Keywords
		$ls_description=$config_rows['siteDescription'];//Description
		$ls_cate=$cate;			//左侧产品类别
		$ls_menu=$menu;		//主菜单
		$ls_allabout=$allabout ;		//About us
		$ls_foot=$foot;		//底部信息
		
		$ls_propage="";
		$mainpart=$allabout ;
		$mainpartsubject="aboutus";
		$filename="../aboutus.html";
		writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_menu,$ls_foot,
$filename,$mainpart,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate);
	 	 if($ls!="all")
 {break;}	
 
	case "feedback":  //生成 feedback
		$index_path="../".$templates_var."/feedback.html";	//模板地址
		$ls_title=$config_rows['companyName'];//title
		$ls_keywords=$config_rows['siteKeywords'];	//Keywords
		$ls_description=$config_rows['siteDescription'];//Description
			//$ls_cate=$pro_cate;																						//左侧产品类别
			//$ls_menu=$menu_pro;																						//主菜单
		$ls_cate=$cate;				//左侧产品类别
		$ls_menu=$menu;	//主菜单
		$ls_feedback=$config_rows['feedback'] ;//feedback
		$ls_feedbackemail=$config_rows['email'] ;//E-Mail
		$ls_foot=$foot;	//底部信息
		
		$ls_propage="";
		$mainpart=$ls_feedback ;
		$mainpartsubject="feedback";
		$filename = "../feedback.html"; 
		writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_menu,$ls_foot,
$filename,$mainpart,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate);

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

	 
	 case "contactus":  //生成 contact us
			
		$contactus.="Address:".$config_rows['address']."<br>\n";
		$contactus.="Tel:".$config_rows['tel']."<br>\n";
		$contactus.="Fax:".$config_rows['fax']."<br>\n";
		$contactus.="E-Mail:<a href=\"mailto:".$config_rows['email']."\">".$config_rows['email']."</a><br>\n";
		$contactus.="MSN:<a href=\"mailto:".$config_rows['MSN']."\">".$config_rows['MSN']."</a><br>\n";
		$contactus.="URL:<a href=\"http://".$config_rows['website']."\">".$config_rows['website']."</a><br>\n";
		$contactus.=$ContactAttach; //联系我们的附件文字： google地图， 地区环境
		
		$index_path="../".$templates_var."/contact.html";//模板地址
		$ls_title=$config_rows['companyName'];	//title
		$ls_keywords=$config_rows['siteKeywords'];	//Keywords
		$ls_description=$config_rows['siteDescription'];//Description
		//$ls_cate=$pro_cate;																						//左侧产品类别
		//$ls_menu=$menu_pro;																						//主菜单
		$ls_cate=$cate;	//左侧产品类别
		$ls_menu=$menu;	//主菜单
		$ls_contactus=$contactus ;//contact us
		$ls_foot=$foot;//底部信息
		
		$ls_propage="";
		$ls_feedbackemail="";
		$mainpart=$contactus ;
		$mainpartsubject="contactus";
		$filename = "../contact.html"; 
		writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_menu,$ls_foot,
$filename,$mainpart,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate);
	 	 if($ls!="all")
 {break;}	



	case "news": //生成新闻 News
	  
	 $news_sql2="select * from ls_news order by ID desc ";
	  
	 $result=$opendb->query($news_sql2);
	$mynum = mysql_num_rows($result);//总产品数
		// 每页数量
	$onepage = $PageNumNews; 
		//共有页数
	$allpages = ceil($mynum/$onepage);
		
	//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
	//页码计算  在ls_syscode里面
	$propage=getPages("news.html",$allpages);
	//页码计算
			
	for ($i=0; $i< $allpages; $i++)
	{ 
		$newslist="";
		if ($i == 0)
   		{ 
	 		$indexpath = "news.html";
		} 
		else 
		{ 
	   		$indexpath = "news".$i.".html";
		}
		$start = $i * $onepage;

		 //查询产品
		 
		$news_sql=$news_sql2." limit ".$start.",".$onepage." ";
		$news_query=$opendb->query($news_sql2);
		while($news_rows=mysql_fetch_assoc($news_query))
		{
			$newslist.="<div style=\"padding-left:15px;\"><img src='Templates/images/news.gif' border='0'> <a href=\"".$newsshowFolders."/news".$news_rows['ID'].".html\">".$news_rows['newsTitle']."</a>";
			$newslist.="<div class=\"xuxian\"></div></div>";
					
			$newstitle=$news_rows['newsTitle'];
			$newstext=$news_rows['newsText'];
			createFolder("../".$newsshowFolders);
					
			$index_newspath="../".$templates_var."/newsshow.html";											//模板地址
			$ls_title=$config_rows['companyName'];												//title
			$ls_keywords=$config_rows['siteKeywords'];										//Keywords
			$ls_description=$config_rows['siteDescription'];							//Description
			$ls_cate=$pro_cate;																						//左侧产品类别
			$ls_menu=$menu_pro;																						//主菜单
			$ls_newstitle=$newstitle ;																		//新闻标题
			$ls_newstext=$newstext;																				//新闻内容
			$ls_url="../";																									//链接		
			$ls_foot=$foot;																								//底部信息
					
			$fp	   = fopen ($index_newspath,"r");
			$newscontent  = fread ($fp,filesize ($index_newspath));
			$newscontent  = str_replace ("{ls_title}",$ls_title,$newscontent);
			$newscontent  = str_replace ("{ls_keywords}",$ls_keywords,$newscontent);
			$newscontent  = str_replace ("{ls_description}",$ls_description,$newscontent);
			$newscontent  = str_replace ("{ls_menu}",$ls_menu,$newscontent);
			$newscontent  = str_replace ("{ls_cate}",$ls_cate,$newscontent);
			$newscontent	= str_replace ("{ls_propage}",$ls_propage,$newscontent);
			$newscontent	= str_replace ("{ls_newstitle}",$ls_newstitle,$newscontent);
			$newscontent	= str_replace ("{ls_newstext}",$ls_newstext,$newscontent);
			$newscontent	= str_replace ("{ls_url}",$ls_url,$newscontent);
			$newscontent  = str_replace ("{ls_foot}",$ls_foot,$newscontent);
			//echo $newscontent;
					
			$filename="../".$newsshowFolders."/news".$news_rows['ID'].".html";
			
			if (is_file ($filename))
			{ 
				 @unlink ($filename); //若文件已存在，则删除
			}
			
		   $handle   = fopen ($filename,"w"); //打开文件指针，
				/*
				检查文件是否被创建且可写
				 */
					 
			if (!is_writable ($filename))
			{ 
				 echo "<script>alert('文件：".$filename."不可写，请检查其属性后重试！');history.go(-1);</script>";
			 }
			if (!fwrite ($handle,$newscontent))
		 	{  //将信息写入文件
			  	echo "<script>alert('生成文件".$filename."失败！');history.go(-1);</script>";
			 } 
			fclose ($handle); //关闭指针
			 //echo "创建<a href='".$filename."'>".$filename."</a>成功！<a href=\"temp.php?ls=normal\"><u>返回</u></a><br/><br/>";
			fclose ($fp);
					
		}
				
		$index_path="../".$templates_var."/news.html";												  //模板地址
		$ls_title=$config_rows['companyName'];												//title
		$ls_keywords=$config_rows['siteKeywords'];										//Keywords
		$ls_description=$config_rows['siteDescription'];							//Description
		$ls_cate=$cate;																								//左侧产品类别
		$ls_menu=$menu;																								//主菜单
		$ls_newslist=$newslist ;																			//新闻news 列表
		$ls_propage=$propage;																					//新闻分页页码
		$ls_foot=$foot;																								//底部信息
			
		$ls_feedbackemail="";
		$mainpart=$ls_newslist ;
		$mainpartsubject="news";
		$filename = "../news.html"; 
		writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_menu,$ls_foot,
$filename,$mainpart,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate);
  		echo "共有".$mynum."条新闻。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
	}//end for , all pages
	 	 if($ls!="all")
 {break;}	
	 
	case "download": //生成下载
		
		$news_sql2="select * from ls_download where enable=1 order by ID desc ";
	  $result=$opendb->query($news_sql2);
		$mynum = mysql_num_rows($result);//总产品数
		// 每页数量
		$onepage = $PageNumDowbloads; 
		//共有页数
		$allpages = ceil($mynum/$onepage);
		
		//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			$propage=getPages("download.html",$allpages);
			//页码计算
			
		for ($i=0; $i< $allpages; $i++)
		{ 
			if ($i == 0)
			{ 
			$indexpath = "download.html";
		  	} 
		  	else 
		  	{ 
				$indexpath = "download".$i.".html";
		  	}
			 $start = $i * $onepage;
			 $downlist="";
		 //查询产品
		 
		 $news_sql=$news_sql2. " limit ".$start.",".$onepage." ";
		// echo $news_sql;
			 $news_query=$opendb->query($news_sql);
	
			 while($news_rows=mysql_fetch_assoc($news_query))
				{
					$downlist.="<div style=\"padding-left:15px;\"><img src='Templates/images/news.gif' border='0'> <a href=\"".$downloadFolders."/".$news_rows['downloadName']."\" title=\"Size:".$news_rows['downloadSize']."KB\">".$news_rows['downloadTitle']."</a> ";
					$downlist.="<div class=\"xuxian\"></div></div>";
				}
				$index_path="../".$templates_var."/download.html";		  //模板地址
				$ls_title=$config_rows['companyName'];				//title
				$ls_keywords=$config_rows['siteKeywords'];			//Keywords
				$ls_description=$config_rows['siteDescription'];	//Description
				$ls_cate=$cate;																								//左侧产品类别
				$ls_menu=$menu;																								//主菜单
				$ls_downlist=$downlist ;																			//新闻news 列表
				$ls_propage=$propage;																					//新闻分页页码
				$ls_foot=$foot;																								//底部信息
				
		$ls_feedbackemail="";
		$mainpart=$ls_downlist;
		$mainpartsubject="download";
		$filename = "../download.html"; 
		writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_menu,$ls_foot,
$filename,$mainpart,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate);

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

				}
	  		
	  		echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
		
		 if($ls!="all")
 {break;}
		
		case "workshop": //生成车间图片(Workshop)
			
		$news_sql2="select * from ls_workshop where enable=1 order by Num desc ";
	  $result=$opendb->query($news_sql);
		$mynum = mysql_num_rows($result);//总产品数
		// 每页数量
		$onepage = $PageNum; 
		//共有页数
		$allpages = ceil($mynum/$onepage);
		
		//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			
			$propage=getPages("workshop.html",$allpages);

			//页码计算
			
			for ($i=0; $i< $allpages; $i++)
			{ 
			if ($i == 0)
			{ 
			$indexpath = "workshop.html";
		  } 
		  else 
		  { 
			$indexpath = "workshop".$i.".html";
		  }
		 $start = $i * $onepage;
		 //查询产品
		 
		 $news_sql2.=" limit ".$start.",".$onepage." ";
			 $news_query=$opendb->query($news_sql2);
	
			 while($news_rows=mysql_fetch_assoc($news_query))
				{
					$list.="
					<div style=\"border-bottom:1px solid #ccc; margin-left:20px; width:98%;\">
						<div style=\"float:left;padding-right:20px;\">
							<a href=\"".$WorkShopFolders."/".$BigFoldersProducts."/".$news_rows['workshopPic']."\" target=\"_ablank\">
							<img src=\"".$WorkShopFolders."/".$SmallFoldersProducts."/".$news_rows['workshopPic']."\" border=\"0\">
							</a>
						</div>
						<div style=\"float:left;\">
							".$news_rows['workshopText']."
						</div>
					</div>
					";
				}
				$index_path="../".$templates_var."/workshop.html";											//模板地址
				$ls_title=$config_rows['companyName'];												//title
				$ls_keywords=$config_rows['siteKeywords'];										//Keywords
				$ls_description=$config_rows['siteDescription'];							//Description
				$ls_cate=$cate;																								//左侧产品类别
				$ls_menu=$menu;																								//主菜单
				$ls_list=$list ;																							//新闻news 列表
				$ls_propage=$propage;																					//新闻分页页码
				$ls_foot=$foot;																								//底部信息
				
		$ls_feedbackemail="";
		$mainpart=$ls_list;
		$mainpartsubject="workshop";
		$filename = "../workshop.html"; 
		writeMainMenuItemFile($index_path,$ls_title,$ls_keywords,$ls_description,$ls_cate,$ls_menu,$ls_foot,
$filename,$mainpart,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate);

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

			}
	  		
	  		echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
		
		 if($ls!="all")
 {break;}
		
		case "rd": //生成研发(R&D)
			
		$news_sql2="select * from ls_rd where enable=1 order by Num desc ";
	  $result=$opendb->query($news_sql);
		$mynum = mysql_num_rows($result);//总产品数
		// 每页数量
		$onepage = $PageNum; 
		//共有页数
		$allpages = ceil($mynum/$onepage);
		
		//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			
			//页码计算
			$propage=getPages("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);
	
			 while($news_rows=mysql_fetch_assoc($news_query))
				{
					$list.="
					<div style=\"border-bottom:1px solid #ccc; width:98%;\">
						<div style=\"float:left;padding-right:10px;\">
							<a href=\"".$WorkShopFolders."/".$BigFoldersProducts."/".$news_rows['Pic']."\" target=\"_ablank\">
							<img src=\"".$WorkShopFolders."/".$SmallFoldersProducts."/".$news_rows['Pic']."\" border=\"0\">
							</a>
						</div>
						<div style=\"float:left;\">
							".$news_rows['Text']."
						</div>
					</div>
									";
				}
				$index_path="../".$templates_var."/rd.html";										//模板地址
				$ls_title=$config_rows['companyName'];												//title
				$ls_keywords=$config_rows['siteKeywords'];										//Keywords
				$ls_description=$config_rows['siteDescription'];							//Description
				$ls_cate=$cate;																								//左侧产品类别
				$ls_menu=$menu;																								//主菜单
				$ls_list=$list ;																			//新闻news 列表
				$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_menu,$ls_foot,
$filename,$mainpart,$mainpartsubject,$ls_feedbackemail,$ls_propage,$s_cate);

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

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

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

	}	  		
	
	  		echo "共有".$mynum."条。总共生成".$allpages."页。<br>生成分页文件完成，如生成不完全，请检查文件权限系统后重新生成！<a href=\"temp.php?ls=other\"><u>返回</u></a><br/><br/>";
		
		 if($ls!="all")
 {break;}
}
?>
		  </td>
		</tr>
	  </table></td>
  </tr>
</table>
</body>
</html>
