<?php
//temp_index.php 1265 文章的列别页及详细页，大类及中类
			$result=$opendb->query($article_sql2);
			$mynum = mysqli_num_rows($result);//总产品数
				// 每页数量
			$onepage = $PageNumArticle==""?$NewPageNum:$PageNumArticle;
				//共有页数
			$allpages = ceil($mynum/$onepage);
				
			//echo "共有".$mynum."个产品。可以生成".$allpages."页.每页".$onepage."个<br>";
			//页码计算  在ls_syscode里面
			$suffix_str0=str_replace(".html","",$catefilename);
			for ($i=0; $i<= $allpages-1; $i++){
				$newslist="";
				$suffix_str=$suffix_str0;
				if($i == 0)
				{
					$suffix_str = $suffix_str;
				} 
				else 
				{
					$suffix_str = $suffix_str."-".$i;
				}
				$start = $i * $onepage;
				$firstar=$suffix_str0.".html";
				$propage=getPagess($firstar,$allpages,$i+1);	 //--
				$article_sql=$article_sql2." limit ".$start.",".$onepage." ";

				$tplshow1="../".$templates_var."/".str_replace(".","show.",$catenews['typeurl']);		//模板地址}
				$tplshow=str_replace(".","show.",$funcnews['typeurl']);
				$tplshow2="../".$templates_var."/".$tplshow;		
				if(file_exists($tplshow1)){$index_newspath=$tplshow1;}else{$index_newspath=$tplshow2;} //模板

			$pathshow=$index_newspath;
			$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;
			
			$p22_s = "%<ls_foreach_scate>(.*?)</ls_foreach_s>%si";    //侧边分类列表
			preg_match_all($p22_s, $contentshow, $arr_s);
			$ls_foreach_scate = $arr_s[1][0];
			$ls_foreach_s0cate = $arr_s[0][0]; //包含
			
		
			$mido = "";
			$article_query=$opendb->query($article_sql);
			while($news_rows=mysqli_fetch_assoc($article_query))
			{
				if(strpos($news_rows['articleText'],'<img') !== false){
					
					$newsImgStr=getStrbyTag("<img ","/>",$news_rows['articleText']);
					$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_articlelist -> $ mainpart  -> ls_syscode (writeMainMenuItemFile) $ ls_articlelist -> {ls_articlelist}
				$news_rows['folder']=$catefolder==""?$funcfolder:$catefolder; //ls_article 没有文件夹,用上级类
				include("_article_list.php"); //article_list
				 // old
				
				if($j<=$onepage)$ls_list_s.= str_replace("{ls_list_s}",$news_rows['articleTitle'],$ls_foreach_s); $j++;

				//模板地址 cate 模板存在用它，否则用func 模板
				$news_rows['folder']=$catefolder==""?$funcfolder:$catefolder;
				$nybnstr=str_replace(".html","",strtolower(str_replace(" ","",$funcnews['functionName']))); //主题图名images字 不带_banner.jpg
				$indicatebarpath=ucwords(strtolower($functionName)).($functionName==$cateName?"": " >> ".ucwords(strtolower($cateName)));
				$menu_pro=str_replace(".html","",$articletplfunc); //面包屑大类链接
				if(file_exists($index_newspath)){
				// 文章详细页	，包括 分类文章

					writeShowPages($news_rows, $index_newspath,"article", "article", $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), $indicatebarpath, $translate, $d_pro_cate);
				}else{
					if($ls_debug) echo "<p>模版文件".$index_newspath."不存在，请设计好模板后重新生成。</p>";	
				}
			}//end this page
		
		// 文章列表页   
			//echo $articletplfunc."-=-=";
			if($articletplfunc=="") {echo $catenews['functionName']."-".$catenews['cateName']." 模板文件名不存在。<br/>";continue;}
			$index_path="../".$templates_var."/".$articletplfunc;						  //模板地址
			$ls_title=$catenews['fTitle'];												//title
			$ls_keywords=$catenews['fKeywords'];										//Keywords
			$ls_description=$catenews['fDescription'];//Description
			$ls_brief=$catenews['brief'];												//title
	
			$ls_cate=ucwords(strtolower($functionName)).($functionName==$cateName?"": " >> ".ucwords(strtolower($cateName)));																					 
			$ls_motif=$s_m_cate;
			$ls_menu=$menu;																								//主菜单
			$ls_propage=$propage;																					//文章分页页码
			$ls_foot=$foot;																								//底部信息
	
			$ls_feedbackemail="";
			$mainpart=$mido ; //文章news 列表
			//echo $mainpart."---".$i;
			$mainpartsubject="article";
			$nybnstr=str_replace(".html","",strtolower(str_replace(" ","",$funcnews['functionName'])));//主题图名images字 _banner 

			$filename ="../".( $articletplcate==""?str_replace(".",$catenews['ID'].".",$articletplfunc):$articletplcate);
			$filename = $i!=0? str_replace(".html","-".$i.".html",$filename):$filename;
			
			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);
			//if($mynum==1) copy($firstar,$filename) ; //一篇文章，覆盖列表页
		} //end for all pages

?>