Creating news articles is probably the one thing that really pushed RSS to its popularity. News in its basic definition is to inform and educate based on facts. Now that is not to say the news sometimes has opinions added to the mix. Either way, the electronic masses needed to get their articles out in a way for all to read and to get them when they were published. Enter RSS.
Using RSS to feed news is one of the most easiest ways to inform your readers of what is going on. As mentioned in my previous articles, you may want to build a front end interface, using ASP of course, to enter your news articles into your database. Having this front end will allow you to easily enter any new articles and not have to worry about getting into the database to enter them manually.
There are two parts to creating the RSS feed.
The header and the body. The header consist of some basic RSS code to format the feed correctly so that is can be read and processed by the readers. (You can get a free one from www.RSSReader.com) The body will include the information that is pulled from the database.
Here is how the header will always look:
<% Response.Buffer = true
Response.ContentType = "text/xml"
if len(strInput) > 0 then
strInput = Replace(strInput,"'", "'")
strInput = Replace(strInput,"""",
strInput = Replace(strInput, ">",
strInput = Replace(strInput,"<","<")
strInput = ""
ApplyXMLFormatting = strInput
Again, this will make sure that the RSS Reader can read the file correctly. The next piece is the body which will process the news records from the database. As long as you have the fields setup in the database, you should be good to go. (http://www.bellaonline.com/articles/art46418.asp)
The body of the file can look like this:
<title>RSS Job Board -
<description>RSS Job Board for
<title>ASP @ BellaOnline.com</title>
Set objConn =
Set objRS =
"Provider=sqloledb;Data Source=DBSERVER;Initial Catalog=ARTICLEDB;User Id=sa;Password=sqlpassword;"
objConn.CursorLocation = 3
Dim objRS, strSQL, strDesc
strSQL = "SELECT * FROM RSSTable
WHERE (DateAdded <= '" & Now() & "') order by DateAdded DESC"
objRS.Open strSQL, objConn
Do While Not objRS.EOF
strDesc = "<b>Job Posted by " &
objRS("Owner") & " on " & _
objRS("DateAdded") & "
PST</b><br>" & _
Set objRS = Nothing
Set objConn = Nothing
Then save the file as an ASP or an RSS. (RSS making sure you have setup your server to accept RSS file requests as ASP – http://www.bellaonline.com/articles/art30642.asp)
If you have problems or questions regarding this or any other article, please let me know. firstname.lastname@example.org