您所在的位置:小祥子 » CMS学院 » 新云 » 正文

新云4.0文章频道内容页调用相关软件的修改说明

时间:2015-01-08 编辑:佚名 来源:互联网

1、/common/news/show.ASP
找到:
Case "relatedlist" : Set XmlDatalistNode=RelatedListNode(iXMLDom)
加上:
Case "softrelatedlist" : Set XmlDatalistNode=NewsToSoftRelatedListNode(iXMLDom)

在文件底部‘%>’前加入(代码较长,复制时请注意):
Function NewsToSoftRelatedListNode(iXMLDom)
Dim SQL,Rs,datalist,Node,strQuery,i
Dim maxnum,stype,rootNode,imgWidth,imgHeight,strLength
Dim datemode,showcate,showdate,showimg,strTarget
Dim cLength,sTitle,eachline,w,strwidth
Dim strLink1,strLink2,strLink3,strImageLink,strChannelDir
Dim strRelated, arrRelated,strKey, strLikeQuery,relatedmode
On Error Resume Next
relatedmode=NewAsp.ChkNumeric(TPL_Config(10))
If IsNull(iXMLDom.documentElement.getAttribute("ellipsis")) Then iXMLDom.documentElement.setAttribute "ellipsis","..."
If Trim(iXMLDom.documentElement.getAttribute("ellipsis"))="0" Then
NewAsp.Ellipsis=""
Else
NewAsp.Ellipsis=iXMLDom.documentElement.getAttribute("ellipsis")
End If

maxnum = NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("maxnum"))
stype = NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("type"))
rootNode = NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("node"))
imgWidth = NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("width"))
imgHeight = NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("height"))
strLength = NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("length"))
datemode = NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("datemode"))
showcate = NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("showcate"))
showdate = NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("showdate"))
showimg = NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("image"))
strTarget = NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("target"))
eachline = NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("eachline"))

Template.setLineWidth Eachline,strwidth,w

If Len(datemode)=0 Then datemode="yyyy-MM-dd"
If maxnum=0 Then maxnum=10
If rootNode = "" Or rootNode = "row" Or rootNode = "xml" Then rootNode = "datalist"
If NewAsp.BindDomain=0 Then
strChannelDir=NewAsp.ChannelDir
End If

strRelated = Replace(Replace(Replace(Replace(m_strRelated, "[", ""), "]", ""), "%", ""), ",", "|")
strKey = NewAsp.CheckSpecialChar(Left(m_strTitle,4))
If Len(strRelated)>1 Then
If InStr(strRelated, "|") > 1 Then
arrRelated = Split(strRelated, "|")
If relatedmode=1 Then
strRelated = "((A.SoftName like '" & arrRelated(0) & "%')"
strLikeQuery = "((A.SoftName like '" & arrRelated(0) & "%')"
Else
strRelated = "((A.SoftName like '%" & arrRelated(0) & "%')"
strLikeQuery = "((InStr(1,LCase(A.SoftName),LCase('"& arrRelated(0) &"'),0)>0)"
End If
For i = 1 To UBound(arrRelated)
If relatedmode=1 Then
strRelated = strRelated & " Or (A.SoftName like '" & arrRelated(i) & "%')"
strLikeQuery = strLikeQuery & " Or (A.SoftName like '" & arrRelated(i) & "%')"
Else
strRelated = strRelated & " Or (A.SoftName like '%" & arrRelated(i) & "%')"
strLikeQuery = strLikeQuery & " Or (InStr(1,LCase(A.SoftName),LCase('"& arrRelated(i) &"'),0)>0)"
End If
Next
strRelated = strRelated & ")"
strLikeQuery = strLikeQuery & ")"
Else
If relatedmode=1 Then
strLikeQuery = "(A.SoftName like '" & strRelated & "%' Or A.SoftName like '" & strKey & "%')"
strRelated = "(A.SoftName like '" & strRelated & "%' Or A.SoftName like '" & strKey & "%')"
Else
strLikeQuery = "(InStr(1,LCase(A.SoftName),LCase('"& strRelated &"'),0)>0 Or InStr(1,LCase(A.SoftName),LCase('"& strKey &"'),0)>0)"
strRelated = "(A.SoftName like '%" & strRelated & "%' Or A.SoftName like '" & strKey & "%')"
End If
End If
Else
If relatedmode=1 Then
strLikeQuery = "(A.SoftName like '" & strKey & "%')"
strRelated = "(A.SoftName like '" & strKey & "%')"
Else
strLikeQuery = "(InStr(1,LCase(A.SoftName),LCase('"& strKey &"'),0)>0)"
strRelated = "(A.SoftName like '%" & strKey & "%')"
End If
End If

Select Case stype
Case 1: strQuery=" And A.isBest>0 ORDER BY A.softtime DESC ,A.softid DESC"
Case 2: strQuery=" ORDER BY A.AllHits DESC ,A.softid DESC"
Case 3: strQuery=" And A.isBest>0 ORDER BY A.AllHits DESC ,A.softid DESC"
Case 4: strQuery=" And A.isTop>0 ORDER BY A.softtime DESC ,A.softid DESC"
Case 5: strQuery=" And A.star=5 ORDER BY A.softtime DESC ,A.softid DESC"
Case Else
strQuery=" ORDER BY A.softtime DESC ,A.softid DESC"
End Select
If IsSqlDataBase = 1 Then
strQuery=" And "&strRelated&strQuery
Else
strQuery=" And "&strLikeQuery&strQuery
End If
SQL=" A.softid,A.ClassID,A.ColorMode,A.FontMode,A.SoftName,A.SoftVer,A.subtitle,A.OuterLinks,A.Softsize,A.Author,A.SoftImage,A.Previewimg,A.AllHits,A.SoftTime,A.plugin,A.HtmlFileDate,A.isBest,A.Regsite,A.star,"
SQL="SELECT TOP " & maxnum & SQL & " C.ClassName,C.ClassDir,C.HtmlFileDir,B.ChannelName,B.ChannelDir,B.HtmlExtName,B.IsCreateHtml,B.BindDomain,B.sortDestination,B.InfoDestination FROM ([NC_SoftList] A INNER JOIN [NC_Classify] C ON A.ClassID=C.ClassID) INNER JOIN [NC_Channel] B ON B.ChannelID = A.ChannelID WHERE A.isAccept>0 " & strQuery
Set Rs=NewAsp.Execute(SQL)
If Err Then
Set Rs=Nothing
Exit Function
End If
Set datalist=NewAsp.RecordsetToxml(rs,"row",rootNode)
Rs.Close : Set Rs=Nothing
SQL=Empty

If Not datalist Is Nothing Then
i = 0
For Each Node in datalist.documentElement.SelectNodes("row")
i = i + 1
If Node.selectSingleNode("@binddomain").text=0 Then
strChannelDir = Node.selectSingleNode("@channeldir").text
ChannelPath=Newasp.InstallDir & Node.selectSingleNode("@channeldir").text

Else
ChannelPath="/"

End If
Node.attributes.setNamedItem(datalist.createNode(2,"url","")).text= ChannelPath
Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text = i
Node.attributes.setNamedItem(datalist.createNode(2,"w","")).text = w
Node.attributes.setNamedItem(datalist.createNode(2,"linewidth","")).text = strwidth
If Eachline>0 Then
If (i Mod Eachline)=0 Then
Node.attributes.setNamedItem(datalist.createNode(2,"br","")).text="<br style=""clear:both"" />"
Else
Node.attributes.setNamedItem(datalist.createNode(2,"br","")).text=""
End If
Else
Node.attributes.setNamedItem(datalist.createNode(2,"br","")).text=""
End If
If (i mod 2) = 0 Then
Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 2
Else
Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 1
End If
If showdate=0 Then
Node.selectSingleNode("@softtime").text=""
Else
Node.selectSingleNode("@softtime").text=NewAsp.FormatToDate(Node.selectSingleNode("@softtime").text,datemode)
End If
If showcate=0 Then
Node.selectSingleNode("@classname").text=""
cLength=0
Else
cLength=NewAsp.strLength(Node.selectSingleNode("@classname").text)+2
End If

sTitle=NewAsp.CutStr(Node.selectSingleNode("@softname").text&" "&Node.selectSingleNode("@softver").text,strLength-cLength)
Node.selectSingleNode("@softname").text=Replace(Node.selectSingleNode("@softname").text, "<", "<")
strImageLink = NewAsp.GetImagePath(Node.selectSingleNode("@softimage").text,Node.selectSingleNode("@url").text)
Node.selectSingleNode("@softimage").text=NewAsp.GetImagePath(Node.selectSingleNode("@softimage").text,Node.selectSingleNode("@url").text)

If Node.selectSingleNode("@iscreatehtml").text=0 Then

If IsURLRewrite Then
strLink1=CheckURLRewrite(ChannelPath,Node.selectSingleNode("@softid").text & Node.selectSingleNode("@htmlextname").text)
strLink2=CheckURLRewrite(ChannelPath,"list_1_"&Node.selectSingleNode("@classid").text & Node.selectSingleNode("@htmlextname").text)
Else
strLink1=Newasp.InstallDir & Node.selectSingleNode("@channeldir").text & "show.asp?id="&Node.selectSingleNode("@softid").text
strLink2=Newasp.InstallDir & Node.selectSingleNode("@channeldir").text & "list.asp?classid="&Node.selectSingleNode("@classid").text
End If
Else
strLink1=NewAsp.HtmlDestination(Node.selectSingleNode("@infodestination").text, strChannelDir, Node.selectSingleNode("@htmlfiledate").text,Node.selectSingleNode("@htmlfiledir").text,Node.selectSingleNode("@classid").text,Node.selectSingleNode("@softid").text,1,"")
If showcate=1 Then
strLink2=NewAsp.HtmlDestination(Node.selectSingleNode("@sortdestination").text, strChannelDir, Node.selectSingleNode("@htmlfiledate").text,Node.selectSingleNode("@htmlfiledir").text,Node.selectSingleNode("@classid").text,Node.selectSingleNode("@softid").text,1,"")
End If
End If
If Len(Node.selectSingleNode("@outerlinks").text&"")>8 Then
strLink1=Node.selectSingleNode("@outerlinks").text
End If
strLink3=CommentsLinks
Response.Write Node.selectSingleNode("@sortdestination").text
Node.attributes.setNamedItem(datalist.createNode(2,"link","")).text=strLink1
Node.attributes.setNamedItem(datalist.createNode(2,"link2","")).text=strLink2
Node.attributes.setNamedItem(datalist.createNode(2,"link3","")).text=strLink3
Node.attributes.setNamedItem(datalist.createNode(2,"imglink","")).text=strImageLink
Node.attributes.setNamedItem(datalist.createNode(2,"topic","")).text=NewAsp.ReadFontMode(Replace(sTitle, "<", "<"),Node.selectSingleNode("@colormode").text,Node.selectSingleNode("@fontmode").text)
Node.attributes.setNamedItem(datalist.createNode(2,"title","")).text=NewAsp.RemoveHtml(Node.selectSingleNode("@softname").text&" "&Node.selectSingleNode("@softver").text)
If Len(strTarget)>1 Then
Node.attributes.setNamedItem(datalist.createNode(2,"linktarget","")).text=" target="""&strTarget&""""
Else
Node.attributes.setNamedItem(datalist.createNode(2,"linktarget","")).text=""
End If
Next
Set Node=Nothing
End If

Set NewsToSoftRelatedListNode=datalist
Set datalist=Nothing
End Function




在文章内容页模板(show.html)中插入标签:{$xml:datalist id="softrelatedlist" file="related.xslt" type="0" length="27" maxnum="12" }即可调用相关软件

由于程序本身‘域名绑定功能’的功能有缺陷,如要使用‘新云4文章频道内容页调用相关软件’请关闭‘域名绑定功能’
 

关键词:相关 调用
本类热门