28,391
社区成员
发帖
与我相关
我的任务
分享
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Const HTML_Article_Path = "html/"
ID=request("id")
Page = Request.QueryString("Page")
If Page = "" Then Page = 1
Call Article_Page_Html(ID,Page)
Private Sub Article_Page_Html(ID,iPage)
If iPage = 1 Then
FilePath = "../" & HTML_Article_Path & ID & ".html"
Else
FilePath = "../" & HTML_Article_Path & ID & "_" & iPage & ".html"
End If
FromURL = sPath & "list.asp?id=" & ID & "&thisPage=" & iPage & "&rnd=" & Now()
Call ToHtml(FromURL,FilePath)
End Sub
Private Sub ToHtml(FromURL,FilePath)
Response.Write("<a href=""" & FilePath & """ target=""_blank"">" & FilePath & " --> Ok</a><br>")
FilePath = Server.MapPath(FilePath)
Set objXmlHttp=Server.createObject("Microsoft." & "XMLHTTP")
objXmlHttp.open "GET",FromURL,false
objXmlHttp.send()
binFileData=objXmlHttp.responseBody
Set objXmlHttp = Nothing
Set objAdoStream=Server.createObject("ADODB." & "Stream")
objAdoStream.Type=1
objAdoStream.Open()
objAdoStream.Write(binFileData)
objAdoStream.SaveToFile FilePath,2
objAdoStream.Close()
Set objAdoStream = Nothing
End Sub
%>
<!--#include file="../../Inc/conn.asp"-->
<!--#include file="../../Inc/ubb.asp"-->
<!--#include file="../../Inc/fenye.asp"-->
<!--#include file="../../Inc.asp"-->
<%id=request("id")%>
<%
Sub ArtHtml(ID)
Dim ChannelDir
ChannelDir = "../html/"
Call oCreateFolder(ChannelDir)
Sql="Select ID,Content From Yao_Article Where Yn = 0 "
If ID <> "" Then
Sql=Sql& " And ID = "&ID&""
End If
Sql=Sql & " order by ID desc"
Set oRs = Conn.Execute(Sql)
If Not oRs.EOF Then
ID = oRs(0)
Content = oRs(1)
End If
oRs.Close
Set oRs = Nothing
If InStr(Content,"[yao_page]") > 0 Then
Content_Tmp = Split(Content,"[yao_page]")
Page_Count = Ubound(Content_Tmp)+1
For iPage=1 To Page_Count
If iPage = 1 Then
FilePath = ChannelDir & ID & ".html"
Else
FilePath = ChannelDir & ID & "_" & iPage & ".html"
End If
FromURL = http://"&request.ServerVariables("Server_NAME")&""&SitePath&"list.asp?id=" & ID & "&Page=" & iPage & "&rnd=" & Now()
Call ToHtml(FromURL,FilePath)
Next
Else
FilePath = ChannelDir & ID & ".html"
FromURL = http://"&request.ServerVariables("Server_NAME")&""&SitePath&"list.asp?id=" & ID & "&rnd=" & Now()
Call ToHtml(FromURL,FilePath)
End If
End Sub
Private Sub ToHtml(FromURL,FilePath)
Response.Write("<a href=""" & FilePath & """ target=""_blank"">" & FilePath & " --> Ok</a><br>")
FilePath = Server.MapPath(FilePath)
Set objXmlHttp=Server.createObject("Microsoft." & "XMLHTTP")
objXmlHttp.open "GET",FromURL,false
objXmlHttp.send()
binFileData=objXmlHttp.responseBody
Set objXmlHttp = Nothing
Set objAdoStream=Server.createObject("ADODB." & "Stream")
objAdoStream.Type=1
objAdoStream.Open()
objAdoStream.Write(binFileData)
objAdoStream.SaveToFile FilePath,2
objAdoStream.Close()
Set objAdoStream = Nothing
End Sub
%>
Private Sub Article_Page_Html(ID,iPage)
'这里把ID传进来了。就要根据ID区你的文章表里面查询出该文章的内容。最后将内容进行分页处理
If Page = 1 Then
FilePath = "../" & HTML_Article_Path & ID & ".html"
Else
FilePath = "../" & HTML_Article_Path & ID & "_" & Page & ".html"
End If
FromURL = "http://"&request.ServerVariables("Server_NAME")&""&SitePath&"list.asp?id=" & ID & "&Page=" & iPage & "&rnd=" & Now()
Call ToHtml(FromURL,FilePath)
End Sub
'==========================生成新闻文章静态页===================================
Sub ArtHtml(ID)
Dim ChannelDir
ChannelDir = "/art/"
Call oCreateFolder(ChannelDir)
Sql="Select ID,Content From Art Where 1 = 1 "
If ID <> "" Then
Sql=Sql& " And ID = "&ID&""
End If
Sql=Sql & " order by ID desc"
Set oRs = Conn.Execute(Sql)
If Not oRs.EOF Then
ID = oRs(0)
Content = oRs(1)
End If
oRs.Close
Set oRs = Nothing
If InStr(Content,"[NextPage]") > 0 Then
Content_Tmp = Split(Content,"[NextPage]")
Page_Count = Ubound(Content_Tmp)+1
For iPage=1 To Page_Count
If iPage = 1 Then
FilePath = ChannelDir & ID & ".html"
Else
FilePath = ChannelDir & ID & "_" & iPage & ".html"
End If
FromURL = Html_SysSiteUrl & "View_Art.asp?id=" & ID & "&thisPage=" & iPage & "&rnd=" & Now()
Call ToHtml(FromURL,FilePath)
Next
Else
FilePath = ChannelDir & ID & ".html"
FromURL = Html_SysSiteUrl & "View_Art.asp?id=" & ID & "&rnd=" & Now()
Call ToHtml(FromURL,FilePath)
End If
End Sub