ASP blog: begræns antal posts
Jeg benytter flg. script til at hente blogindlæg i en rss-fil. Hvordan begrænser jeg antallet af indlæg der bliver indlæst?<%
TheFeed = "rss.xml"
Set objXML = Server.CreateObject("Microsoft.XMLDOM")
objXML.Async = False
objXML.SetProperty "ServerHTTPRequest", True
objXML.ResolveExternals = True
objXML.ValidateOnParse = True
objXML.Load(TheFeed)
CellCount = 0
If (objXML.parseError.errorCode = 0) Then
Set objRoot = objXML.documentElement
If IsObject(objRoot) = False Then
Response.Write "There was an error retrieving the news feed"
Else
Set objItems = objRoot.getElementsByTagName("item")
If IsObject(objItems) = True Then
For Each objItem in objItems
On Error Resume Next
TheTitle = objItem.selectSingleNode("title").Text
TheLink = objItem.selectSingleNode("link").Text
TheDesc = objItem.selectSingleNode("description").Text
TheDate = objItem.selectSingleNode("pubDate").Text
Response.Write "<span class='blogh'><b>" & TheTitle & "</b></span>" & _
"<br><span class='blogc'><i>Den "
Response.Write FormatDateTime(Now, vbLongDate) & _
" kl. "
Response.Write FormatDateTime(Now, vbShortTime) & _
"</i></span><br /><span class='blogc'>"
Response.Write TheDesc & _
"</span><hr size='1' color='#d7d7d7' width='100%'>"
Next
End If
Set objItems = Nothing
End If
Else
Response.Write "Der opstod en fejl i læsning af RSS feedet"
End If
Set objXML = Nothing
%>