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

📄 cl_function_article.asp

📁 正版创力4.1SQL商业版!!!ASP版。
💻 ASP
📖 第 1 页 / 共 4 页
字号:
<%
'===================================================
' CreateLive CMS Version 4.0
'							Powered by Aspoo.CoM
'===================================================
' File: Cl_Function_Article.asp
' Date: 2005-10-31
' Mail: support@aspoo.cn, Info@aspoo.cn
' Q  Q: 3315263, 596197794
' Msn : support@aspoo.cn, Clw866@hotmail.com
' Web : http://www.aspoo.com, http://www.aspoo.net
' Bbs : http://bbs.aspoo.com, http://bbs.aspoo.net
' Copyright (C) 2005-2007 Aspoo.CoM All Rights Reserved.
'===================================================
Public Sub Article_Setting()
	CurrentPath = Cl.Language.selectSingleNode("//CurrentPath").text & "<a href='" & Cl.Web_info(4) & "'>" & Cl.Web_info(0) & "</a> &gt;&gt; <a href='" & Cl.WebDir & Cl.ChannelDir & "'>" & Cl.ChannelName & "</a>"
	Cl.Title = Cl.NoHtml(Cl.ChannelName) & " " & Cl.GotTopic(Cl.ChannelReadMe,50) & "[" & Cl.Web_info(1) & "]"
	if InfoID>0 then
		Set Rs = Cl.Execute("select * From Cl_Article where InfoID=" & InfoID)
		if rs.bof and rs.eof then
			rs.Close : Set rs=Nothing
			Call Cl.OutErr(0,Replace(Cl.Language.selectSingleNode("//InfoNoFind").text,"{$channelitemname}",Cl.ChannelItemName))
		end if
		if rs("ChannelID")<>ChannelID Or rs("Deleted")=True Or rs("Status")<>1 Then
			rs.Close : Set rs=Nothing
			Call Cl.OutErr(0,Replace(Cl.Language.selectSingleNode("//InfoNoFind").text,"{$channelitemname}",Cl.ChannelItemName))
		end If
		ClassID = rs("ClassID")
		InfoTitle = rs("Title")
		if rs("Hot")=False then
			if rs("hits")>=Clng(Cl.Web_Setting(14)) then Cl.Execute("Update Cl_Article Set Hot=" & TrueType & " where InfoID=" & InfoID & "")
		end if
		Template.TemplateID = 0
		If CLng(Cl.Channel.selectSingleNode("@info_projectid").text)>0 Then
			Template.ProjectID = CLng(Cl.Channel.selectSingleNode("@info_projectid").text)
			If CLng(Cl.Channel.selectSingleNode("@info_templateid").text)>0 Then Template.TemplateID = CLng(Cl.Channel.selectSingleNode("@info_templateid").text)
			If CLng(Cl.Channel.selectSingleNode("@info_cssid").text)>0 Then Template.CssID = CLng(Cl.Channel.selectSingleNode("@info_cssid").text)
		End if
	end if
	if ClassID>0 Then
		Set tClass = Application(Cl.CacheName&"_classlist").documentElement.selectSingleNode("class[@classid="&ClassID&"]")
		If tClass Is Nothing Then Call Cl.OutErr(0,Cl.Language.selectSingleNode("//ClassNoFind").text)
		ClassName	= tClass.selectSingleNode("@classname").text
		ParentID	= CLng(tClass.selectSingleNode("@parentid").text)
		ParentPath	= tClass.selectSingleNode("@parentpath").text
		ClassDir	= tClass.selectSingleNode("@classdir").text
		ParentDir	= tClass.selectSingleNode("@parentdir").text
		RootID		= CLng(tClass.selectSingleNode("@rootid").text)
		Depth		= CLng(tClass.selectSingleNode("@depth").text)
		Child		= CLng(tClass.selectSingleNode("@child").text)
		arrChildID	= tClass.selectSingleNode("@arrchildid").text
		BrowsePurview=CLng(tClass.selectSingleNode("@browsepurview").text)
		VipUser		= tClass.selectSingleNode("@vipuser").text
		ClassProjectID= CLng(tClass.selectSingleNode("@projectid").text)
		ClassTemplateID = CLng(tClass.selectSingleNode("@templateid").text)
		ClassCssID	= CLng(tClass.selectSingleNode("@cssid").text)
		If CLng(Cl.Channel.selectSingleNode("@class_projectid").text)>0 Then
			Cl.ProjectID = CLng(Cl.Channel.selectSingleNode("@class_projectid").text)
			'Template.TemplateID = CLng(Cl.Channel.selectSingleNode("@class_templateid").text)
			Cl.CssID = CLng(Cl.Channel.selectSingleNode("@class_cssid").text)
		End if
		If ClassProjectID > 0 Then
			Cl.ProjectID = ClassProjectID
			Cl.CssID = ClassCssID
		End if
		If ParentID>0 Then
			Dim tNode,tParent,i
			tParent = Split(ParentPath,",")
			For i=1 To UBound(tParent)
				Set tNode = Application(Cl.CacheName&"_classlist").documentElement.selectSingleNode("class[@classid=" & tParent(i) & "]")
				If Not tNode Is Nothing Then 
				CurrentPath=CurrentPath & " &gt;&gt; <a href='" & tNode.selectSingleNode("@linkurl").text & "'>" & tNode.selectSingleNode("@classname").text & "</a>"
				End If
				Set tNode=Nothing
			Next
			tParent = Null
		End If
		CurrentPath=CurrentPath & " &gt;&gt; <a href='" & tClass.selectSingleNode("@linkurl").text & "'>" & ClassName & "</a>"
		Set tClass = Nothing
	end if
End Sub
'Rem 文章
Function GetArticle(Byval sChannelID,Byval sClassID,Byval sSpecialID,Byval TopNum,Byval IncludeChild,Byval ShowType, _
Byval ColsNum,Byval IsHot,Byval IsElite,Byval DateNum,Byval OrderType,Byval Style1,Byval Style2,Byval Style3)
	Dim JsSQL,sHTML,sTitleMaxLen,TitleStr,LinkUrl,FileType
	Dim Author,AuthorName,AuthorEmail
	Dim SystemTopDir,SystemDir
	Dim Rs,i
	On Error Resume Next
	SystemTopDir	= "http://"&Request.servervariables("Server_Name")
	SystemDir		= SystemTopDir & Cl.WebDir
	sChannelID		= Clng(sChannelID)
	sClassID		= Clng(sClassID)
	sSpecialID		= Clng(sSpecialID)
	TopNum			= Clng(TopNum)
	IncludeChild	= CBool(IncludeChild)
	ShowType		= Clng(ShowType)
	ColsNum			= Clng(ColsNum)
	IsHot			= CBool(IsHot)
	IsElite			= CBool(IsElite)
	DateNum			= CLng(DateNum)
	OrderType		= CLng(OrderType)
	Style1			= Trim(Style1)
	Style2			= Trim(Style2)
	Style3			= Trim(Style3)
	if Err then Err.Clear : GetArticle="GetArticle参数错误。":Exit Function
	On Error GoTo 0
	if TopNum > 0 then
		JsSQL="select top " & TopNum & " "
	else
		JsSQL="select top 100 "
	end if
	JsSQL=JsSQL & " A.InfoID,A.ChannelID,A.ChannelDir,A.ClassID,C.ClassName,C.ParentPath,C.ClassDir,C.ParentDir,A.Title,A.Prefixion,A.Author,A.CopyFrom,A.Editor,A.Keyword,A.Hits,A.DayHits,A.WeekHits,A.MonthHits,A.UpdateTime,A.OnTop,A.Hot,A.Elite,A.Status,A.Content,A.PicUrl,A.InfoGroup,A.InfoPoint,A.Stars,A.FontColor,A.FontType,A.IsHtml,A.HtmlFileUrl,A.Intro,A.IsLink from Cl_Article A"
	JsSQL=JsSQL & " inner join Cl_Class C on A.ClassID=C.ClassID where A.Deleted="&FalseType&" and A.Status=1"
	if sChannelID>0 then JsSQL=JsSQL & " and A.ChannelID="&sChannelID&""
	if sClassID>0 then
		if IncludeChild=True then
			Dim tClass
			set tClass=Cl.Execute("select ClassID,ParentPath,arrChildID From Cl_Class where ClassID=" & sClassID)
			if tClass.bof and tClass.eof then
				GetArticle="找不到指定的栏目。" : set tClass=Nothing : Exit Function
			else
				JsSQL=JsSQL & " and A.ClassID in (" & tClass(2) & ")"
			end if
			set tClass=Nothing
		else
			JsSQL=JsSQL & " and A.ClassID=" & sClassID & ""
		end if
	end if
	if sSpecialID>0 then JsSQL=JsSQL & " and A.SpecialID like '%," & SpecialID & ",%'"
	if ShowType >= 2 then JsSQL=JsSQL & " and A.PicUrl<>''"
	if IsHot=True then JsSQL=JsSQL & " and A.Hot="&TrueType&""
	if IsElite=True then JsSQL=JsSQL & " and A.Elite="&TrueType&""
	if DateNum>0 then
		if IsSqlDatabase=1 then
			JsSQL=JsSQL & " and datediff(d,A.UpdateTime,"&SQLNowString&")<=" & DateNum & " "
		else
			JsSQL=JsSQL & " and datediff('d',A.UpdateTime,"&SQLNowString&")<=" & DateNum & " "
		end if
	end if
	JsSQL=JsSQL & " order by A.OnTop asc"
	Select Case OrderType
	Case 1 : JsSQL=JsSQL & " ,A.InfoID desc"
	Case 2 : JsSQL=JsSQL & " ,A.InfoID asc"
	Case 3 : JsSQL=JsSQL & " ,A.UpDateTime desc, A.InfoID desc"
	Case 4 : JsSQL=JsSQL & " ,A.UpDateTime asc, A.InfoID desc"
	Case 5 : JsSQL=JsSQL & " ,A.Hits desc, A.InfoID desc"
	Case 6 : JsSQL=JsSQL & " ,A.Hits asc, A.InfoID desc"
	Case else : JsSQL=JsSQL & " ,A.InfoID desc"
	End Select
	set Rs=server.createObject("Adodb.recordset")
	OpenConn : Rs.open JsSQL,Conn,1,1
	if Rs.bof and Rs.eof then 
		GetArticle = "当前没有记录!"
		Rs.close:set Rs=Nothing : Exit Function
	End if
	JsSQL=Rs.GetRows(-1)
	Rs.close:set Rs=Nothing
	Dim TempBody
	Dim regEx,Matches,Match,TempStr
	Dim PropertyImg,ClassFileUrl,sImgUrl
	TempBody="":sHTML=""
	Set regEx	= New RegExp
	regEx.Pattern = "{\$.[^{\$}]*}"
	regEx.IgnoreCase = True
	regEx.Global = True
	For i=0 to Ubound(JsSQL,2)
		TempBody	= Style2
		Set Matches = regEx.Execute(TempBody)
		For Each Match in Matches
			TempStr = Replace(Match.Value,"{$","")
			TempStr = Replace(TempStr,"}","")
			TempStr = Replace(TempStr,"(",",")
			TempStr = Replace(TempStr,")","")
			TempStr = Replace(TempStr,"""","")
			TempStr = Split(Lcase(TempStr),",")
			Select Case TempStr(0)
			Case "linkurl"
				if JsSQL(30,i)=True then
					LinkUrl = SystemDir & JsSQL(31,i)
				elseif JsSQL(33,i)=True then
					LinkUrl = JsSQL(31,i)
				else
					LinkUrl = SystemDir & JsSQL(2,i) & "/ShowInfo.asp?InfoID=" & JsSQL(0,i)
				end if
				TempBody = Replace(TempBody,Match.Value,LinkUrl)
			Case "infoid" : TempBody = Replace(TempBody,Match.Value,JsSQL(0,i))
			Case "prefixion" : TempBody = Replace(TempBody,Match.Value,JsSQL(9,i)&"")
			Case "propertyimg"
				if JsSQL(19,i)=True then
					PropertyImg = "<img src=""" & InstallDir & "Images/ArticleOntop.gif"" alt=""固顶"" />"
				elseif JsSQL(21,i)=True then
					PropertyImg = "<img src=""" & InstallDir & "Images/ArticleElite.gif"" alt=""推荐"" />"
				else
					PropertyImg = "<img src=""" & InstallDir & "Images/ArticleCommon.gif"" alt=""普通"" />"
				end if
				TempBody = Replace(TempBody,Match.Value,PropertyImg)
			Case "classid" : TempBody = Replace(TempBody,Match.Value,JsSQL(3,i))
			Case "classname" : TempBody = Replace(TempBody,Match.Value,JsSQL(4,i))
			Case "classurl" : TempBody = Replace(TempBody,Match.Value,SystemDir & JsSQL(2,i) & "/ShowClass.asp?ClassID=" & JsSQL(3,i))
			Case "authorname"
				if InStr(JsSQL(10,i),"|")>0 then
					AuthorName	= Split(JsSQL(10,i),"|")(0)
				else
					AuthorName	= JsSQL(10,i)
				end if
				TempBody = Replace(TempBody,Match.Value,AuthorName)
			Case "authoremail"
				if InStr(JsSQL(10,i),"|")>0 then
					AuthorEmail	= Split(JsSQL(10,i),"|")(1)
				else
					AuthorEmail	= ""
				end if
				TempBody = Replace(TempBody,Match.Value,AuthorEmail)
			Case "hits" : TempBody = Replace(TempBody,Match.Value,JsSQL(14,i))
			Case "dayhits" : TempBody = Replace(TempBody,Match.Value,JsSQL(15,i))
			Case "weekhits" : TempBody = Replace(TempBody,Match.Value,JsSQL(16,i))
			Case "monthhits" : TempBody = Replace(TempBody,Match.Value,JsSQL(17,i))
			Case "title"
				TitleStr = Cl.GotTopic(JsSQL(8,i),TempStr(1))
				TitleStr = Cl.GetTitleFont(TitleStr,JsSQL(29,i))
				TitleStr = Cl.FormatColor(TitleStr,JsSQL(28,i))
				TempBody = Replace(TempBody,Match.Value,TitleStr)
			Case "imgurl"
				FileType=right(lcase(JsSQL(24,i)),3)
				JsSQL(24,i) = Cl.GetPicUrl(JsSQL(24,i))
				Select Case FileType
				Case "swf"
					sImgUrl = "<object classid=""clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"" codebase=""http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"" width=""{$ImgWidth}"" height=""{$ImgHeight}""><param name=""movie"" value=""" & JsSQL(24,i) & """><param name=""quality"" value=""high""><embed src=""" & JsSQL(24,i) & """ pluginspage=""http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"" type=""application/x-shockwave-flash"" width=""{$ImgWidth}"" height=""{$ImgHeight}""></embed></object>"
				Case "jpg", "bmp", "png", "gif"
					sImgUrl = "<img src=""" & JsSQL(24,i) & """ width=""{$ImgWidth}"" height=""{$ImgHeight}"" border=0>"
				Case Else
					sImgUrl = "<img src=""" & SystemDir & "images/NoPic2.jpg"" width=""{$ImgWidth}"" height=""{$ImgHeight}"" border=0>"
				End Select
				sImgUrl	 = Replace(sImgUrl,"{$ImgWidth}",TempStr(1))
				sImgUrl	 = Replace(sImgUrl,"{$ImgHeight}",TempStr(2))
				TempBody = Replace(TempBody,Match.Value,sImgUrl)
			Case "intro"
				TempBody = Replace(TempBody,Match.Value,Left(JsSQL(32,i)&"",TempStr(1)))
			Case "updatetime"
				TempBody = Replace(TempBody,Match.Value,Cl.Format_Time(JsSQL(18,i),TempStr(1)))
			End Select
		Next
		sHTML = sHTML & TempBody
		if (i+1) mod ColsNum=0 then sHTML = sHTML & Style3
	Next
	GetArticle=Replace(Style1,"{$ContentBody}",sHTML)
	JsSQL=Empty
End Function

'=================================================
'过程名:ShowClassArticle(sChannelID,sClassID,ModNum,TopNum)
'参  数:
'		sChannelID	----	频道ID
'		sClassID	----	指定栏目,多个用“|”分隔,不指定请留空或0
'		ModNum      ---		多少个换行
'		TopNum      ---		最多显示记录数
'=================================================
Function ShowClassArticle(Byval sChannelID,Byval sClassID,Byval ModNum,Byval TopNum)
	Dim sqlRoot,rsRoot,ClassCount,iClassID,nClassID
	Dim sTemp,strValue,ClassLinkUrl
	sChannelID	= Cl.GetClng(sChannelID)
	sClassID	= Trim(sClassID)
	ModNum		= Cl.GetClng(ModNum)
	if sClassID="" or sClassID="0" then
		TopNum		= Cl.GetClng(TopNum)
		if TopNum=0 then TopNum = 6
		sqlRoot="select Top "&TopNum&" ClassID,ClassName,ParentPath,ClassDir,ParentDir,RootID,Child,arrChildID,Readme From Cl_Class where ChannelID="&sChannelID&" and ParentID=0 and IsElite="&TrueType&" and IsOuter=0 order by RootID"
	Else
		sqlRoot="select ClassID,ClassName,ParentPath,ClassDir,ParentDir,RootID,Child,arrChildID,Readme From Cl_Class where ChannelID="&sChannelID&" and IsElite="&TrueType&" and IsOuter=0 and ClassID In ("&Replace(sClassID,"|",",")&") order by RootID"
	End if
	Set rsRoot= Cl.Execute(sqlRoot)
	if rsRoot.bof and rsRoot.eof then
		sTemp="还没有任何栏目,请首先添加栏目。"
		rsRoot.Close:Set rsRoot=Nothing:Exit Function
	end if
	sqlRoot=rsRoot.GetRows(-1)
	rsRoot.Close:Set rsRoot=Nothing
	Dim TemplateHTMLStr
	TemplateHTMLStr = Template.GetTemplate(Cl.GetDefaultTemplateID(1,9,Template.ProjectID))
	TemplateHTMLStr = Replace(TemplateHTMLStr,"{$webdir}",InstallDir)
	TemplateHTMLStr = Replace(TemplateHTMLStr,"{$csspicurl}",Cl.WebDir & Cl.CssPicUrl)
	TemplateHTMLStr = Split(TemplateHTMLStr,"@@@")
	'If ChannelID=0 Then ChannelID = sChannelID
	nClassID = Ubound(sqlRoot,2)
	for iClassID=0 to nClassID
		ClassID = sqlRoot(0,iClassID)
		ClassLinkUrl = Cl.GetClassLinkUrl(sqlRoot(0,iClassID))
		strValue=TemplateHTMLStr(1)
		strValue=Replace(strValue,"{$channelid}",sChannelID)
		strValue=Replace(strValue,"{$classid}",sqlRoot(0,iClassID))
		strValue=Replace(strValue,"{$classtitle}",sqlRoot(8,iClassID)&"")
		strValue=Replace(strValue,"{$classname}",sqlRoot(1,iClassID))
		strValue=Replace(strValue,"{$classfileurl}",ClassLinkUrl)
		strValue=Replace(strValue,"{$classlinkurl}",ClassLinkUrl)
		strValue=Template.ReplaceFlag(strValue,"showarticle","")
		If iClassID<nClassID then
			if ((iClassID+1) mod ModNum) = 0 then
				strValue = strValue & TemplateHTMLStr(3)
			else
				strValue = strValue & TemplateHTMLStr(2)
			end If

⌨️ 快捷键说明

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