<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Conn.asp" -->
<!--#include file="Config.asp" -->
<%
    set rsnewscount=conn.execute("select count(ID) from news ")
	num=rsnewscount(0)
    rsnewscount.close:Set rsnewscount=nothing
	
	set rsnewsid=conn.execute("select max(ID) from news ")
	maxid=rsnewsid(0)
	rsnewsid.close:Set rsnewsid=nothing
	
	maxper=20
	
	if num mod maxper = 0 then
	   totalpage=num \ maxper 
	else   
	   totalpage=num \ maxper + 1
	end if
	
	
	'set rsn=server.CreateObject("adodb.recordset")
	'rsn.open"",conn,1,1
	for p=1 to totalpage
        
		FileName="List"
		
		set fso=CreateObject("Scripting.FileSystemObject") 
		set f=fso.OpenTextFile(server.mappath("/temp/News.html")) 
		StrContent=f.ReadAll 
		f.close 
		set f=nothing 
		set fso=nothing 
		
		StrContent=Replace(StrContent,"$$SiteKeyword$$",SiteKey)
		StrContent=Replace(StrContent,"$$SiteTitle$$",SiteTitle)
		StrContent=Replace(StrContent,"$$NewsTitle$$","新闻中心第"&p&"页")
		StrContent=Replace(StrContent,"$$SiteName$$",SiteName)
		StrContent=Replace(StrContent,"$$SiteUrl$$",SiteUrl)
		
		
		StrContent=Replace(StrContent,"$$CompanyNews(行业动态,8)$$",CompanyNews("行业动态",8))
		
		StrContent=Replace(StrContent,"$$News()$$",News(maxper,maxid+1,FileName,p,totalpage))
		
		StrContent=Replace(StrContent,"$$SiteBottom$$",SiteBottom)
		StrContent=Replace(StrContent,"$$Keyword$$",Keyword())
	
	    StrContent=Replace(StrContent,"$$BusinessArt$$",Business())
	
	
		set fso=CreateObject("Scripting.FileSystemObject") 
		
		set f=fso.CreateTextFile(server.mappath("/News/"&FileName&"_"&p&".html"), true ) 
		f.WriteLine(StrContent) 
		f.close 
		set f = nothing 
		if p=1 then
		    set f1=fso.CreateTextFile(server.mappath("/News/index.html"), true ) 
			f1.WriteLine(StrContent) 
			f1.close 
			set f1 = nothing 
		end if
		
		set fso = nothing 
    next

response.Write("<script language='javascript'>alert('网站资讯生成！');location.href='sysadmin_view.asp';</script>")
response.End()

%>
