高手帮忙!关于逻辑判断的一段函数
Private Sub LoadFriendLink(iXMLDom)Dim SQL,Rs,i,Node,datalist
Dim sAppID,rootNode,strQuery
Dim channid,maxnum,stype,setcache
Dim isLogo,linkmode,strLinks,strImage
Dim Eachline,w,strwidth
If IsNull(iXMLDom.documentElement.getAttribute("action")) Then iXMLDom.documentElement.setAttribute "action","0"
If IsNull(iXMLDom.documentElement.getAttribute("select")) Then iXMLDom.documentElement.setAttribute "select","0"
If IsNull(iXMLDom.documentElement.getAttribute("eachline")) Then iXMLDom.documentElement.setAttribute "eachline","0"
If IsNull(iXMLDom.documentElement.getAttribute("islogo")) Then iXMLDom.documentElement.setAttribute "islogo",""
If IsNull(iXMLDom.documentElement.getAttribute("linkmode")) Then iXMLDom.documentElement.setAttribute "linkmode",""
If IsNull(iXMLDom.documentElement.getAttribute("target")) Then iXMLDom.documentElement.setAttribute "target","_blank"
setcache = NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("setcache"))
channid = NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("channelid"))
maxnum = NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("maxnum"))
stype = NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("type"))
rootNode = NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("node"))
isLogo = NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("islogo"))
linkmode = NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("linkmode"))
eachline = NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("eachline"))
setLineWidth Eachline,strwidth,w
If setcache="" Then setcache="0"
If maxnum=0 Or maxnum>100 Then maxnum=10
sAppID = NewAsp.CacheName &"_friendlink_"&setcache
If rootNode = "" Or rootNode = "row" Or rootNode = "xml" Then rootNode = "datalist"
Select Case stype
'-- 首页显示按时间升序排列
Case 1: strQuery="And isIndex>0 ORDER BY LinkTime DESC,LinkID DESC"
'-- 首页显示按点击数升序排列
Case 2: strQuery="And isIndex>0 ORDER BY LinkHist DESC,LinkID DESC"
'-- 首页显示按点击数降序排列
Case 3: strQuery="And isIndex>0 ORDER BY LinkHist DESC,LinkID ASC"
'-- 所有按升序排列
Case 4: strQuery="ORDER BY LinkID DESC"
'-- 所有按降序排列
Case 5: strQuery="ORDER BY LinkID ASC"
'-- 所有按点击数升序排列
Case 6: strQuery="ORDER BY LinkHist DESC,LinkID DESC"
'-- 所有按点击数降序排列
Case 7: strQuery="ORDER BY LinkHist DESC,LinkID ASC"
'-- 首页显示按名称排列
Case 8: strQuery="And isIndex>0 ORDER BY LinkName DESC,LinkID DESC"
'-- 所有按名称排列
Case 9: strQuery="ORDER BY LinkName DESC,LinkID DESC"
Case Else
strQuery="And isIndex>0 ORDER BY LinkTime Asc,LinkID ASC"
End Select
If isLogo=0 Then
SQL = "SELECT TOP "&maxnum&" LinkID,LinkName,LinkUrl,LogoUrl,Readme,LinkHist,isLogo FROM [NC_Link] WHERE isLock=0 And isLogo=0 " & strQuery
Else
SQL = "SELECT TOP "&maxnum&" LinkID,LinkName,LinkUrl,LogoUrl,Readme,LinkHist,isLogo FROM [NC_Link] WHERE isLock=0 And isLogo>0 " & strQuery
End If
If Not CacheIsObject(setcache,sAppID) Then
Set Rs = NewAsp.Execute(SQL)
Set datalist = NewAsp.RecordsetToxml(rs,"row",rootNode)
Rs.Close:Set Rs = Nothing
If EnabledCache(setcache) Then
Application.Lock
Set Application(sAppID)=datalist
Application.unLock
End If
If Not datalist Is Nothing Then
i=0
For Each Node In datalist.documentElement.SelectNodes("row")
i=i+1
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 linkmode>0 Then
strLinks=NewAsp.InstallDir&"link/link.asp?id="&Node.selectSingleNode("@linkid").text&"&url=" & Trim(Node.selectSingleNode("@linkurl").text)
If NewAsp.BindDomain=1 Then strLinks=NewAsp.MainDomain&strLinks
Else
strLinks=Trim(Node.selectSingleNode("@linkurl").text)
End If
If CLng(Node.selectSingleNode("@islogo").text)>0 Then
strImage=NewAsp.CheckLinksUrl(Node.selectSingleNode("@logourl").text)
Node.selectSingleNode("@logourl").text=strImage
End If
Node.attributes.setNamedItem(datalist.createNode(2,"link","")).text=strLinks
Node.attributes.setNamedItem(datalist.createNode(2,"title","")).text=Node.selectSingleNode("@linkname").text
Next
Set Node = Nothing
If Eachline>1 Then
Dim moreline
If i<Eachline Then moreline=Eachline-i Else moreline=Eachline-(i Mod Eachline)
If moreline>0 And moreline<Eachline Then
strLinks=NewAsp.InstallDir&"link/"
If NewAsp.BindDomain=1 Then strLinks=NewAsp.MainDomain&strLinks
For i=i+1 To i+moreline
Set Node=datalist.createNode(1,"row","")
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
Node.attributes.setNamedItem(datalist.createNode(2,"linkhist","")).text=0
Node.attributes.setNamedItem(datalist.createNode(2,"linkid","")).text=0
Node.attributes.setNamedItem(datalist.createNode(2,"islogo","")).text=isLogo
Node.attributes.setNamedItem(datalist.createNode(2,"logourl","")).text=strLinks&"link.gif"
Node.attributes.setNamedItem(datalist.createNode(2,"title","")).text="更多链接"
Node.attributes.setNamedItem(datalist.createNode(2,"linkname","")).text="更多链接"
Node.attributes.setNamedItem(datalist.createNode(2,"readme","")).text="更多链接"
Node.attributes.setNamedItem(datalist.createNode(2,"linkurl","")).text=strLinks
Node.attributes.setNamedItem(datalist.createNode(2,"link","")).text=strLinks
datalist.documentElement.appendChild(Node)
Set Node=Nothing
Next
End If
End If
End If
Else
Set datalist=Application(sAppID)
End If
If Not datalist Is Nothing Then iXMLDom.documentElement.appendChild(datalist.documentElement.cloneNode(True))
Set datalist=Nothing
End Sub
上面的这段是友情链接的显示方式的模板源码,判断islogo字段为0则显示为文字链接,islogo>0则为logo链接。现在我想修改为大于0的都用文字链接,小于0的则用文本链接。请问如何实现?因为我要用分类,为了整套程序的前台调用,不得不改,恳请高手赐教。