<!--#include file="../../p_inc/Include_func.asp"-->
<!--#include file="../inc/public.asp"-->
<!--#include file="../inc/openconn.asp"-->
<%
response.Buffer=true
Server.ScriptTimeOut=9999999

Response.Buffer=True
response.contenttype="text/html;charset=gb2312"
IF Not ChkPost() Then
	'response.Redirect G_error_page_1
	'response.End()
End IF
typeid2_c=request("typeid2_c")
typeid2_c=StayNub(typeid2_c)
IF typeid2_c="" Then 
	typeid2_c=0
Else
	typeid2_c=Cint(typeid2_c)
End IF
l_k=request("l_k")
l_k=StayNub(l_k)
IF l_k="" Then 
	l_k=1
Else
	l_k=Cint(l_k)
End IF
'totalpage=request("totalpage")
'totalpage=StayNub(totalpage)
'IF totalpage="" Then totalpage=1
'生成的静态页目录 
saveurl=url_(array("newsall",typeid2_c,"",l_k))


sxpage=Request("xpage")




	IF l_k>3 Then
		IF sxpage="1" Then '是否加速生成
			IF N_FSo.C_N_IsExists(Add_Root_Dir(saveurl)) Then
				response.Write typeid2_c&"|||"&l_k&"|||"&Session("totalpage_s")
				Response.End()
			End IF
		End IF
	End IF


	
	Allcontent_top=Qingtiandy_getfilecontent(server.MapPath(Add_Root_Dir("/template/"&G_moban&"/"&G_moban_html&"/top.html")))
	Allcontent_buttom=Qingtiandy_getfilecontent(server.MapPath(Add_Root_Dir("/template/"&G_moban&"/"&G_moban_html&"/button.html")))	
	
	
	
		oldurl=Add_Root_Dir("/template/"&G_moban&"/"&G_moban_html&"/NewsList.html")
	
		Allcontent=Qingtiandy_getfilecontent(server.MapPath(oldurl))
		Apurl="../../"
		
		Allcontent=replace(replace(replace(replace(replace(Allcontent,"{qt:template_top}",Allcontent_top),"{qt:template_button}",Allcontent_buttom),"../images/",Apurl&"template/"&G_moban&"/images/"),"../css/",Apurl&"template/"&G_moban&"/css/"),"../js/",Apurl&"template/"&G_moban&"/js/")
		Allcontent=replace(Allcontent,"{qt:newsm_type1}",typeid2_c)
		Allcontent=replace(Allcontent,"{qt:indexurl}",Apurl)
		Allcontent=replace(Allcontent,"{当前页}",l_k)



		
		Get_sql_str=GetContent(Allcontent,"{qt_Loop:NewsLoopList","}",0)
		Get_sql_str_2=GetContent(Allcontent,"{qt_Loop:NewsLoopList","}",1)
		sql_list=Get_sql_3(Get_sql_str)
		IF instr(sql_list,"|")>0 Then
			sql_list_1=split(sql_list,"|")
			sql_list_sql=sql_list_1(0)
			sql_list_numb=sql_list_1(1)
		End IF
		IF Instr(Get_sql_str,",")>0 Then
			Get_sql_str_a=split(Get_sql_str,",")
			Get_sql_str_a_3=Get_sql_str_a(3) '表示显示的数目
		End IF	
		set rs_l1=server.createobject(G_RS)
		rs_l1.open sql_list_sql,conn,1,1
		
		rs_l1.pagesize=sql_list_numb	
		totalpage= rs_l1.pagecount
		totalrecordcount=rs_l1.recordcount
		IF totalpage<=1 Then
			totalpage=1
		End IF	
			
		IF Cint(l_k)<=Cint(totalpage) Then	
			Session("totalpage_s")=	totalpage	
			pageurl=G_HTML
				
			Allcontent_t=Allcontent
			Allcontent_t=replace(Allcontent_t,"{qt:当前地址栏}","http://"&Request.ServerVariables("HTTP_HOST")&saveurl)
			'{qt_Loop:NewsList 1,{qt:newsm_type1},0,4,1,}
			Set re_list = New RegExp
			re_list.IgnoreCase = True
			re_list.Global=True	
			re_list.Pattern ="{qt_Loop:NewsLoopList\s+([^\,]+),([^\,]+),([^\,]+),([^\,]+),([^\,]+),([^\,]*)}"
			Get_sql_str_3=re_list.Replace(Get_sql_str_2, "{qt_Loop:NewsLoopList $1,$2,$3,$4,"&l_k&",$6}")
			Get_sql_str_3=replace(Get_sql_str_3,"NewsLoopList","NewsList")
			Allcontent_t=replace(Allcontent_t,Get_sql_str_2,Get_sql_str_3)	
			p1_r=GetContent(Allcontent_t,"{qt_page}","{/qt_page}",1)
			p1_r2=replace(replace(p1_r,"{qt_page}",""),"{/qt_page}","")
			str_page_1=Get_page_cms(p1_r2,l_k,Get_sql_str_a_3,totalrecordcount,totalpage,pageurl)			
			Allcontent_t=replace(replace(Allcontent_t,p1_r,str_page_1),"{$qt_page$}",str_page_1)


	
			Allcontent_t=MakeHTML_CMS(Allcontent_t)
			
				
			N_Fso.CreateFolderFile saveurl,Allcontent_t
			
			IF  l_k=1 Then '要多生成一个页面
				saveurl=url_(array("newsall",typeid2_c,"",0))
				N_Fso.CreateFolderFile saveurl,Allcontent_t
			End IF
			
			response.Write typeid2_c&"|||"&l_k&"|||"&totalpage	
		Else
			response.Write typeid2_c&"|||"&totalpage&"|||"&totalpage
		End IF		
%>
