create_articleindexcls.asp

来自「多用户管理分权限发布、管理软件信息;  自由选择系统默认为静态HTML或动态A」· ASP 代码 · 共 435 行 · 第 1/2 页

ASP
435
字号
<%
Class Create_ArticleIndex_Cls
	Private ErrMsg
	Private SucMsg
	Private Founderr
	Private NC_Admin, Rs, SQL
	Private Sub Class_Initialize()
		Founderr = False
		Set Rs = Server.CreateObject("ADODB.Recordset")
		Newasp.LoadTemplates ("infoindex")
	End Sub

	Private Sub Class_Terminate()
		If IsObject(Conn) Then
			Conn.Close
			Set Conn = Nothing
		End If
		Set Newasp = Nothing
	End Sub

	Public Sub Init_CreateHtml()
		Server.ScriptTimeout = 99999
		Dim FileName, HtmlTemplate
		Set NC_Admin = New Check
		NC_Admin.AdminChk = "34"
		NC_Admin.Check
		Newasp.admin_header
		If CInt(Newasp.Setting(5)) = 1 Then NC_Admin.Error_Msg ("对不起!你选择动态ASP程序,不能生成HTML文件,请在基本设置修改成静态HTML方能生成THML文件。"):Exit Sub
		HtmlTemplate = GetArticleIndex
		FileName = Newasp.SetupDir & "Article/Index.html"
		Newasp.CreateNewFiles FileName, HtmlTemplate
		NC_Admin.Succeed_Msg ("生成文章首页的HTML页完成!")
		Response.Write "<meta http-equiv=""refresh"" content=""2;url='Create_Listing.Asp'"">"
		Newasp.admin_footer
	End Sub

	Public Sub ArticleIndex()
		Response.Buffer = True
		If CInt(Newasp.Setting(5)) = 0 Then Response.redirect (Newasp.SetupDir & "Article/Index.html")
		Response.Write GetArticleIndex
	End Sub

	Private Function GetArticleIndex()
		Dim NewCloud_Ads
		Set NewCloud_Ads = New Adcolumn_Cls
		Dim temphtml, NowStats, HtmlTitle
		Dim TempTopStr, TempFootStr
		NowStats = "文章首页"
		HtmlTitle = "文章首页"
		If Len(Newasp.temphtml(0)) < 50 Then
			TempTopStr = Newasp.mainhtml(0) & Newasp.mainhtml(1) & Newasp.mainhtml(2) & Newasp.mainhtml(3)
		Else
			TempTopStr = Newasp.temphtml(0)
		End If
		If Len(Newasp.temphtml(4)) = 0 Then
			TempFootStr = Newasp.mainhtml(4)
		Else
			TempFootStr = Newasp.temphtml(4)
		End If
		temphtml = TempTopStr & Newasp.temphtml(1) & Newasp.temphtml(2) & Newasp.temphtml(3) & TempFootStr
		temphtml = Replace(temphtml, "{$NavMenu}", Newasp.ClassMenu)
		temphtml = Replace(temphtml, "{$Width}", Newasp.mainset(0))
		If CInt(Newasp.Setting(5)) = 0 Then
			temphtml = Replace(temphtml, "{$TopMeun}", Newasp.mainset(9))
		Else
			temphtml = Replace(temphtml, "{$TopMeun}", Newasp.mainset(10))
		End If
		temphtml = Replace(temphtml, "{$FootMeun}", Newasp.mainset(11))
		temphtml = Replace(temphtml, "{$Style_CSS}", Newasp.Style_CSS)
		temphtml = Replace(temphtml, "{$NowStats}", NowStats)
		temphtml = Replace(temphtml, "{$Title}", HtmlTitle)
		temphtml = Replace(temphtml, "{$NewArticle}", NewArticle)
		temphtml = Replace(temphtml, "{$BestArticle}", BestArticle)
		temphtml = Replace(temphtml, "{$Message}", WebMessage(2))
		temphtml = Replace(temphtml, "{$Statistic}", Statistics)
		temphtml = Replace(temphtml, "{$ArticleType}", CreateArticleType)
		temphtml = Replace(temphtml, "{$NewPic}", SingleImage("InfoTime"))
		temphtml = Replace(temphtml, "{$HotPic}", SingleImage("Hits"))
		temphtml = Replace(temphtml, "{$ArticleImage}", ArticleImage)
		temphtml = Replace(temphtml, "{$PicNews}", PictureNews)
		temphtml = Replace(temphtml, "{$Adcolumn(0)}", NewCloud_Ads.RunScriptAds(4))
		temphtml = Replace(temphtml, "{$Adcolumn(1)}", NewCloud_Ads.BannerAds(4))
		temphtml = Replace(temphtml, "{$Adcolumn(2)}", NewCloud_Ads.AdsColumn(4, 2))
		temphtml = Replace(temphtml, "{$Adcolumn(3)}", NewCloud_Ads.AdsColumn(4, 3))
		temphtml = Replace(temphtml, "{$Adcolumn(6)}", NewCloud_Ads.AdsColumn(4, 7))
		temphtml = Replace(temphtml, "{$Adcolumn(4)}", NewCloud_Ads.ScriptFloatAds(4))
		temphtml = Replace(temphtml, "{$Adcolumn(5)}", NewCloud_Ads.ScriptFixedAds(4))
		Set NewCloud_Ads = Nothing
		GetArticleIndex = temphtml
	End Function
	'*************************************************************
	'函数作用:最新加入文章
	'*************************************************************
	Private Function NewArticle()
		Dim Rs, SQL, HtmlString, ArticleTitle, ClassName, InfoTime, InfoDate
		Set Rs = Server.CreateObject("adodb.recordset")
		SQL = "select Top " & CInt(Newasp.mainset(19)) & " id,classid,Title, ClassName,InfoTime,Hits from NC_Article where isLock = 0 order by InfoTime desc, id desc"
		Rs.Open SQL, Conn, 1, 1
		If Rs.bof And Rs.EOF Then
			HtmlString = "还没有最新文章!"
		Else
			Do While Not Rs.EOF
				If Rs("InfoTime") >= Date Then
					InfoTime = "<FONT color=red>" & Month(Rs("InfoTime")) & "/" & Day(Rs("InfoTime")) & "</FONT >"
					InfoDate = "<FONT color=red>" & FormatDateTime(Rs("InfoTime"), 2) & "</FONT >"
				Else
					InfoTime = "<FONT color=#999999>" & Month(Rs("InfoTime")) & "/" & Day(Rs("InfoTime")) & "</FONT >"
					InfoDate = "<FONT color=#999999>" & FormatDateTime(Rs("InfoTime"), 2) & "</FONT >"
				End If
				If CInt(Newasp.Setting(5)) = 0 Then
					ArticleTitle = "<A HREF='" & Newasp.SetupDir & "Article/Catalog" & Rs(1) & "/" & Rs(0) & ".html' title='文章标题:" & Rs(2) & "<BR>更新时间:" & Rs(4) & "<BR>浏览次数:" & Rs(5) & "' class='TableLink'>" & Newasp.gotTopic(Rs(2), CInt(Newasp.mainset(20))) & "</A>"
					ClassName = "<A HREF='" & Newasp.SetupDir & "Listing/Catalog" & Rs(1) & "/Listing_Indete_Desc_1.html' title='" & Rs("ClassName") & "'>" & Rs("ClassName") & "</A>"
				Else
					ArticleTitle = "<A HREF='" & Newasp.SetupDir & "Article.asp?id=" & Rs(0) & "' title='文章标题:" & Rs(2) & "<BR>更新时间:" & Rs(4) & "<BR>浏览次数:" & Rs(5) & "' class='TableLink'>" & Newasp.gotTopic(Rs(2), CInt(Newasp.mainset(20))) & "</A>"
					ClassName = "<A HREF='" & Newasp.SetupDir & "Listing.asp?classid=" & Rs(1) & "' title='" & Rs("ClassName") & "'>" & Rs("ClassName") & "</A>"
				End If
				HtmlString = HtmlString & Newasp.mainset(21)
				HtmlString = Replace(HtmlString, "{$ArticleTitle}", ArticleTitle)
				HtmlString = Replace(HtmlString, "{$ClassName}", ClassName)
				HtmlString = Replace(HtmlString, "{$InfoTime}", InfoTime)
				HtmlString = Replace(HtmlString, "{$ArticleHits}", Rs("Hits"))
				HtmlString = Replace(HtmlString, "{$InfoDate}", InfoDate)
				Rs.movenext
			Loop
		End If
		Rs.Close
		Set Rs = Nothing
		NewArticle = HtmlString
	End Function
	'*************************************************************
	'函数作用:推荐文章
	'*************************************************************
	Private Function BestArticle()
		Dim Rs, SQL, HtmlString, ArticleTitle, ClassName, InfoTime, InfoDate
		Set Rs = Server.CreateObject("adodb.recordset")
		SQL = "select Top " & CInt(Newasp.TempSet(14)) & " id,classid,Title, ClassName,InfoTime,Hits,isTop from NC_Article where isLock = 0 And isCommend = 1 order by isTop desc, InfoTime desc, id desc"
		Rs.Open SQL, Conn, 1, 1
		If Rs.bof And Rs.EOF Then
			HtmlString = "还没有推荐文章!"
		Else
			Do While Not Rs.EOF
				If Rs("InfoTime") >= Date Then
					InfoTime = "<FONT color=red>" & Month(Rs("InfoTime")) & "/" & Day(Rs("InfoTime")) & "</FONT >"
					InfoDate = "<FONT color=red>" & FormatDateTime(Rs("InfoTime"), 2) & "</FONT >"
				Else
					InfoTime = "<FONT color=#999999>" & Month(Rs("InfoTime")) & "/" & Day(Rs("InfoTime")) & "</FONT >"
					InfoDate = "<FONT color=#999999>" & FormatDateTime(Rs("InfoTime"), 2) & "</FONT >"
				End If
				If CInt(Newasp.Setting(5)) = 0 Then
					ArticleTitle = "<A HREF='" & Newasp.SetupDir & "Article/Catalog" & Rs(1) & "/" & Rs(0) & ".html' title='文章标题:" & Rs(2) & "<BR>更新时间:" & Rs(4) & "<BR>浏览次数:" & Rs(5) & "' class='TableLink'>" & Newasp.gotTopic(Rs(2), CInt(Newasp.TempSet(15))) & "</A>"
					ClassName = "<A HREF='" & Newasp.SetupDir & "Listing/Catalog" & Rs(1) & "/Listing_Indete_Desc_1.html' title='" & Rs("ClassName") & "'>" & Rs("ClassName") & "</A>"
				Else
					ArticleTitle = "<A HREF='" & Newasp.SetupDir & "Article.asp?id=" & Rs(0) & "' title='文章标题:" & Rs(2) & "<BR>更新时间:" & Rs(4) & "<BR>浏览次数:" & Rs(5) & "' class='TableLink'>" & Newasp.gotTopic(Rs(2), CInt(Newasp.TempSet(15))) & "</A>"
					ClassName = "<A HREF='" & Newasp.SetupDir & "Listing.asp?classid=" & Rs(1) & "' title='" & Rs("ClassName") & "'>" & Rs("ClassName") & "</A>"
				End If
				HtmlString = HtmlString & Newasp.TempSet(16)
				HtmlString = Replace(HtmlString, "{$BestTopic}", ArticleTitle)
				HtmlString = Replace(HtmlString, "{$ClassName}", ClassName)
				HtmlString = Replace(HtmlString, "{$InfoTime}", InfoTime)
				HtmlString = Replace(HtmlString, "{$ArticleHits}", Rs("Hits"))
				HtmlString = Replace(HtmlString, "{$InfoDate}", InfoDate)
				Rs.movenext
			Loop
		End If
		Rs.Close
		Set Rs = Nothing
		BestArticle = HtmlString
	End Function
	'*************************************************************
	'函数作用:图文
	'*************************************************************
	Private Function PictureNews()
		Dim Rs, SQL, HtmlString, ArticleTitle, ClassName, InfoTime, InfoDate
		Set Rs = Server.CreateObject("adodb.recordset")
		SQL = "select Top " & CInt(Newasp.TempSet(17)) & " id,classid,Title, ClassName,InfoTime,Hits from NC_Article where isLock = 0 And isImg = 1 order by InfoTime desc, id desc"
		Rs.Open SQL, Conn, 1, 1
		If Rs.bof And Rs.EOF Then
			HtmlString = "还没有图文信息!"
		Else
			Do While Not Rs.EOF
				If Rs("InfoTime") >= Date Then
					InfoTime = "<FONT color=red>" & Month(Rs("InfoTime")) & "/" & Day(Rs("InfoTime")) & "</FONT >"
					InfoDate = "<FONT color=red>" & FormatDateTime(Rs("InfoTime"), 2) & "</FONT >"
				Else
					InfoTime = "<FONT color=#999999>" & Month(Rs("InfoTime")) & "/" & Day(Rs("InfoTime")) & "</FONT >"
					InfoDate = "<FONT color=#999999>" & FormatDateTime(Rs("InfoTime"), 2) & "</FONT >"
				End If
				If CInt(Newasp.Setting(5)) = 0 Then
					ArticleTitle = "<A HREF='" & Newasp.SetupDir & "Article/Catalog" & Rs(1) & "/" & Rs(0) & ".html' title='文章标题:" & Rs(2) & "<BR>更新时间:" & Rs(4) & "<BR>浏览次数:" & Rs(5) & "' class='TableLink'>" & Newasp.gotTopic(Rs(2), CInt(Newasp.TempSet(18))) & "</A>"
					ClassName = "<A HREF='" & Newasp.SetupDir & "Listing/Catalog" & Rs(1) & "/Listing_Indete_Desc_1.html' title='" & Rs("ClassName") & "'>" & Rs("ClassName") & "</A>"
				Else
					ArticleTitle = "<A HREF='" & Newasp.SetupDir & "Article.asp?id=" & Rs(0) & "' title='文章标题:" & Rs(2) & "<BR>更新时间:" & Rs(4) & "<BR>浏览次数:" & Rs(5) & "' class='TableLink'>" & Newasp.gotTopic(Rs(2), CInt(Newasp.TempSet(18))) & "</A>"
					ClassName = "<A HREF='" & Newasp.SetupDir & "Listing.asp?classid=" & Rs(1) & "' title='" & Rs("ClassName") & "'>" & Rs("ClassName") & "</A>"
				End If
				HtmlString = HtmlString & Newasp.TempSet(19)
				HtmlString = Replace(HtmlString, "{$Topic}", ArticleTitle)
				HtmlString = Replace(HtmlString, "{$ClassName}", ClassName)
				HtmlString = Replace(HtmlString, "{$InfoTime}", InfoTime)
				HtmlString = Replace(HtmlString, "{$ArticleHits}", Rs("Hits"))
				HtmlString = Replace(HtmlString, "{$InfoDate}", InfoDate)
				Rs.movenext
			Loop
		End If
		Rs.Close
		Set Rs = Nothing
		PictureNews = HtmlString
	End Function
	'*************************************************************
	'函数作用:站内公告
	'*************************************************************
	Private Function WebMessage(statid)
		Dim Rs, SQL, HtmlString, MsgTitle, PostTime
		Set Rs = Server.CreateObject("adodb.recordset")
		SQL = "select Top " & CInt(Newasp.TempSet(0)) & " * from NC_Message where statid in (0, " & statid & ") order by isTop desc, Postime desc, id desc"
		Rs.Open SQL, Conn, 1, 1
		If Rs.bof And Rs.EOF Then
			HtmlString = "没有公告!"
		Else

⌨️ 快捷键说明

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