![]() |
#2
yms1232013-06-06 09:40
|
以下是函数

Private Function show_topic_link(tID)
Dim tName,s
tName=Get_Topic_Name(tID)
If tName="-" Then
s=tName
Else
s="<a href=""topicList.asp?topicID="& tID &""">"& tName &"</a>"
End If
show_topic_link=s
End Function
Private Function list_Topic_Name()
Dim tName,tID,num,one,data
For i=0 To Ubound(topic_xmlArray,2)
tID=topic_xmlArray(0,i)
tName=topic_xmlArray(1,i)
one="<option value="""&tID&""">"&tName&"</option>"
data=data & one & vbcrlf
Next
list_Topic_Name=data
End Function
'| 取得第一个专题名称
Private Function Get_Topic_Name(nums)
Dim tName,num
tName="-"
num=""&Trim(nums)
If IsNumeric(num) Then
For i=0 To Ubound(topic_xmlArray,2)
If Trim(topic_xmlArray(0,i))=Trim(num) Then
tName=topic_xmlArray(1,i)
Exit For
End If
Next
End If
Get_Topic_Name=tName
End Function
'| 将topic分类读入到二维数据
Private Function Get_Topic_Info_To_Array(xmlPath,xmlArray)
On Error Resume Next
Dim xml,topic,topic_len,info,i,j,retB
Dim one,data,topic_id,topic_name
j=0 : retB=True
Set xml = Server.CreateObject("Microsoft.XMLDOM")
'xml.load Server.MapPath(topic_info_xml_path) 'xml文件路径
xml.load xmlPath 'xml文件路径
Set topic = xml.getElementsByTagName("TOPIC")
topic_len = topic.length
data=""
If topic_len>0 Then
For i=0 To topic_len-1
Set info= topic.Item(i)
topic_id = info.childNodes.item(0).text
topic_name = info.childNodes.item(1).text
Redim Preserve xmlArray(1,j)
xmlArray(0,j)=""&topic_id
xmlArray(1,j)=""&topic_name
j=j+1
Set info=Nothing
Next
End If
Set topic=Nothing
Set xml=Nothing
If Err Then
Err.Clear
retB=False
End If
Get_Topic_Info_To_Array=retB
End Function
Dim tName,s
tName=Get_Topic_Name(tID)
If tName="-" Then
s=tName
Else
s="<a href=""topicList.asp?topicID="& tID &""">"& tName &"</a>"
End If
show_topic_link=s
End Function
Private Function list_Topic_Name()
Dim tName,tID,num,one,data
For i=0 To Ubound(topic_xmlArray,2)
tID=topic_xmlArray(0,i)
tName=topic_xmlArray(1,i)
one="<option value="""&tID&""">"&tName&"</option>"
data=data & one & vbcrlf
Next
list_Topic_Name=data
End Function
'| 取得第一个专题名称
Private Function Get_Topic_Name(nums)
Dim tName,num
tName="-"
num=""&Trim(nums)
If IsNumeric(num) Then
For i=0 To Ubound(topic_xmlArray,2)
If Trim(topic_xmlArray(0,i))=Trim(num) Then
tName=topic_xmlArray(1,i)
Exit For
End If
Next
End If
Get_Topic_Name=tName
End Function
'| 将topic分类读入到二维数据
Private Function Get_Topic_Info_To_Array(xmlPath,xmlArray)
On Error Resume Next
Dim xml,topic,topic_len,info,i,j,retB
Dim one,data,topic_id,topic_name
j=0 : retB=True
Set xml = Server.CreateObject("Microsoft.XMLDOM")
'xml.load Server.MapPath(topic_info_xml_path) 'xml文件路径
xml.load xmlPath 'xml文件路径
Set topic = xml.getElementsByTagName("TOPIC")
topic_len = topic.length
data=""
If topic_len>0 Then
For i=0 To topic_len-1
Set info= topic.Item(i)
topic_id = info.childNodes.item(0).text
topic_name = info.childNodes.item(1).text
Redim Preserve xmlArray(1,j)
xmlArray(0,j)=""&topic_id
xmlArray(1,j)=""&topic_name
j=j+1
Set info=Nothing
Next
End If
Set topic=Nothing
Set xml=Nothing
If Err Then
Err.Clear
retB=False
End If
Get_Topic_Info_To_Array=retB
End Function