⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 createhtml.asp

📁 html生成静态页的小程序
💻 ASP
字号:

<%
Html_SysSiteUrl = GetPageUrlPath()

'生成静态页面
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 Index_Html()
	FromURL = Html_SysSiteUrl & "../index.asp?rnd=" & Now()
	FilePath = "../index.html"
	Call ToHtml(FromURL,FilePath)
End Sub

'===========================生成关于我们静态页==================================
Private Sub About_Page_Html(ID)
	Sql="select top 1 ID,Content from Ok3w_Article where IsPass=1 and IsDelete=0"
	If ID<>"" Then Sql=Sql& " and ID=" & ID
	Sql=Sql & " order by ID desc"
	Set oRs = Conn.Execute(Sql)
	h_ID = oRs(0)
	Content = oRs(1)
	oRs.Close
	Set oRs = Nothing
	
	Content_Tmp = Split(Content,"[Ok3w_NextPage]")
	Page_Count = Ubound(Content_Tmp)+1
	For iPage=1 To Page_Count
		If iPage = 1 Then
			FilePath = "../about/" & h_ID & ".html"
			Else
				FilePath = "../about/" & h_ID & "_" & iPage & ".html"
		End If
		FromURL = Html_SysSiteUrl & "../about.asp?id=" & h_ID & "&thisPage=" & iPage & "&rnd=" & Now()
		Call ToHtml(FromURL,FilePath)
	Next
End Sub

'==========================生成新闻文章静态页===================================
Private Sub Article_Page_Html(ID)
	Sql="select top 1 ID,Content from Ok3w_Article where IsPass=1 and IsDelete=0"
	If ID<>"" Then Sql=Sql& " and ID=" & ID
	Sql=Sql & " order by ID desc"
	Set oRs = Conn.Execute(Sql)
	h_ID = oRs(0)
	Content = oRs(1)
	oRs.Close
	Set oRs = Nothing
	
	Content_Tmp = Split(Content,"[Ok3w_NextPage]")
	Page_Count = Ubound(Content_Tmp)+1
	For iPage=1 To Page_Count
		If iPage = 1 Then
			FilePath = "../article/" & h_ID & ".html"
			Else
				FilePath = "../article/" & h_ID & "_" & iPage & ".html"
		End If
		FromURL = Html_SysSiteUrl & "../show.asp?id=" & h_ID & "&thisPage=" & iPage & "&rnd=" & Now()
		Call ToHtml(FromURL,FilePath)
	Next	
End Sub

'=======================生成文章列表
Private Sub Article_List_Html(PageNo,ClassID)
	FromURL = Html_SysSiteUrl & "../list.asp?id=" & ClassID & "&PageNo=" & PageNo & "&rnd=" & Now()
	FilePath = "../article/list_" & ClassID & "_" & PageNo & ".html"
	Call ToHtml(FromURL,FilePath)
End Sub

'=======================
Private Sub Page_Html(ChannelID,ClassID,ID)
	Select Case ChannelID
		Case 1
			Call Article_Page_Html(ID)
		Case 2
			Call About_Page_Html(ID)
	End Select
End Sub
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -