注册 登录
编程论坛 ASP技术论坛

求问asp,我把类别写在了xml里面,然后新闻循环的时候类别读取xml后,这个新闻循环的分页就失效了,有人知道为什么?

soso辉 发布于 2013-06-05 11:39, 482 次点击
循环这个<td align="center" nowrap="nowrap"><%=show_topic_link(Recordset1.Fields.Item("mwTopicID"))%></td>
以下是函数
程序代码:
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
1 回复
#2
yms1232013-06-06 09:40
LZ指的是一篇新闻有好几页的那种情况?
1