Looking for ASP script to display RSS?
Check our RSS2HTMLPro.ASP script for
ASP/ASP.NET
How to display and filter
multiple RSS feeds as HTML on ASP/ASP.NET web-server using RSS2HTML
Scout library
You can download the source code of this example
here: rss2htmlscout_asp_filter_keywords.zip
This page provides tutorial
on how to display filtered RSS content on your ASP
or ASP.NET web-site using RSS2HTML Scout library.
RSS2HTML Scout library is capable of converting multiple RSS
feeds into HTML and filtering RSS feeds content by keywords.
<%
' uncomment line below to force cache refresh on every script load
' Response.Expires = -1
' =========== RSS2HTMLScout.ASP for ASP/ASP.NET ==========
' copyright 2005 (c) www.Bytescout.com
' ===============================================
Set RSS2HTMLScout
= CreateObject("RSS2HTMLScoutLib.RSS2HTMLScout")
' ######## we use GET method
' RSS2HTMLScout.Keywords
= Request.QueryString("keywords")
' ######## for POST method uncomment string below
' RSS2HTMLScout.Keywords
= Request.Form("keywords")
' # we set keywords in this script
RSS2HTMLScout.Keywords = "windows
google -gmail update rss ipod"
' ##### we can add more than one RSS feed #########
RSS2HTMLScout.AddFeed "http://rss.news.yahoo.com/rss/internet"
RSS2HTMLScout.AddFeed "http://www.apple.com/main/rss/hotnews/hotnews.rss"
RSS2HTMLScout.AddFeed "http://google.blogspace.com/index.xml"
RSS2HTMLScout.AddFeed "http://blogs.pcworld.com/staffblog/index.rss"
' ##### set flags to serch title, description and URL
RSS2HTMLScout.FilterTitle = true
RSS2HTMLScout.FilterDescription = true
RSS2HTMLScout.FilterURL = false
' ##### max number of displayed items per feed #####
RSS2HTMLScout.ItemsPerFeed
= 5
' ##### Main template constants
RSS2HTMLScout.MainHeader = "<table>"
RSS2HTMLScout.MainFooter = "</table>"
' ##### channel template.
' ##### {LINK} will be replaced with channel link
' ##### {TITLE} will be replaced with channel title
' ##### {DESCRIPTION} will be replaced with channel description
RSS2HTMLScout.ChannelHeader = "<tr><td><b><a href=" & """{LINK}""" & ">{TITLE}</a></b></td></tr>"
RSS2HTMLScout.ChannelFooter = "<tr><td></td></tr>"
' ##### Item template.
' ##### {LINK} will be replaced with item link
' ##### {TITLE} will be replaced with item title
' ##### {DESCRIPTION} will be replaced with item description
RSS2HTMLScout.ItemTemplate = "<tr><td><a href=" & """{LINK}""" & ">{TITLE}</a><BR>{DESCRIPTION}</td></tr>"
' ##### Not found message is used as template to show message if no items were found by filter
' #####
set .NotFoundMessage to "" to show nothing
RSS2HTMLScout.NotFoundMessage = "<tr><td><i>nothing found in <a href=" & """{LINK}""" & ">{TITLE}</a> feed</i></td></tr>"
if RSS2HTMLScout.Execute then
Response.Write RSS2HTMLScout.HTMLOutput
else
Response.Write RSS2HTMLScout.ErrorMessage
End If
Set RSS2HTMLScout = nothing
%>
2)
Save RSS2HTMLScout.asp and place "RSS2HTMLScout.asp" into
root folder of your web-server. (This folder is C:\Inetpub\wwwroot\
by default if you use Internet Information Service (IIS)
on Windows 2000 and XP)
3) Now we will include
content generated by RSS2HTMLScout.asp script into MyPage.ASP.
Below is the content of MyPage.asp:
<html>
<body>
<p>My Page</p>
<p>Filtered RSS content (keywords string hardcoded in RSS2HTMLScout.asp script : <b>windows google -gmail update rss ipod</b>) is displayed below:</p>
<hr>
<!--#include virtual="RSS2HTMLScout.asp"-->
<hr>
<p> </p>
</body>
</html>
) Now open "http://localhost/MyPage.asp" (or "http://<your_webserver_name>/MyPage.asp")
in Internet Explorer
browser. You will see HTML page with content from different RSS
feeds filtered by HTML2RSS Scout library using keywords string
assigned to RSS2HTMLScout.Keywords property:
You can also implement script to allow user enter custom keywords:

You can download the source code of this example including ready-to-use
scripts for GET and POST methods here: rss2htmlscout_asp_filter_keywords.zip
See also:
|