logo
g Text Version
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Sports
Travel & Culture
TV & Movies

dailyclick
Bored? Games!
Nutrition
Postcards
Take a Quiz
Rate My Photo

new
Houseplants
Romance Movies
Creativity
Family Travel
Southwest USA
Irish Culture
Home Finance


dailyclick
All times in EST

Full Schedule
g
g ASP Site

BellaOnline's ASP Editor

g

Coding a RSS Feed - Body

Guest Author - Lisa Shea

It is very easy to use ASP to create a dynamic RSS feed that updates whenever you add fresh content to your site. This page helps you get the body - or core content - part of the RSS file set.

First, make sure you've set up a RSS reader to test your feed, and that you've read about the basics and printed out the sample. Those will be important so that you can test your output. Make sure you've already put in the header / top part of your RSS file, the standard top that would go on most any RSS feed you created.

Now we're at the section of the RSS file that actually contains the changing news announcement, blog updates, whatever it is you are telling people about. Let's say for the sake of argument that you have "articles" and you want to always tell people what your 3 latest articles are. Here's the code block you would use. Note that you have to strip out strange quotes and ampersands in order for XML to work properly. XML works with basic letters and numbers ONLY. It chokes on special characters. Ampersands must be escaped as &

<%
Set FeatSite = Server.CreateObject ("ADODB.Recordset")
SQLText = "SELECT art_id, art_title, art_date, art_desc " & _
"from articles where art_date <= '" & Now() & "' " & _
"order by art_date DESC"
FeatSite.Open SQLText, strConnect, adOpenForwardOnly, adLockReadOnly, adCmdText

FeatCt = 1
do while not FeatSite.EOF and FeatCt < 4

ArtDesc = Replace(FeatSite("art_desc"), chr(180), "'")
ArtDesc = Replace(ArtDesc, "", "'")
ArtDesc = Replace(ArtDesc, "&", "&")

ArtTitle = Replace(FeatSite("art_Title"), chr(180), "'")
ArtTitle = Replace(ArtTitle, "", "'")
ArtTitle = Replace(ArtTitle, "&", "&")

ArtDate = FeatSite("art_date")

ArtHour = Hour(ArtDate)
if ArtHour < 10 then ArtHour = "0" & ArtHour
ArtMin = Minute(ArtDate)
if ArtMin < 10 then ArtMin = "0" & ArtMin
ArtSec = Second(ArtDate)
if ArtSec < 10 then ArtSec = "0" & ArtSec

ArtDateT = WeekdayName(Weekday(ArtDate), TRUE) & ", " & Day(ArtDate) & " " & _
MonthName(Month(ArtDate), TRUE) & " " & Year(ArtDate) & " " & _
ArtHour & ":" & ArtMin & ":" & ArtSec & " EST"
%>
<item>

<title>
<%=ArtTitle%>
</title>

<link>YOURURLGOESHEREPLUS&ARTID=<%=FeatSite("art_id")%>.asp</link>
<description>
<%=ArtDesc%>
</description>

<pubDate><%=ArtDateT%></pubDate>

</item>

<%
FeatSite.MoveNext
FeatCt = FeatCt + 1
loop
FeatSite.close()
set FeatSite = Nothing
%>

</channel>
</rss>

===========================

That's it! Put that RSS file onto your server and make sure you update IIS so that it knows to handle files with an RSS extension as ASP files. Now you should be able to put the URL of that RSS file into your RSS reader, and get the updates!

RSS Feed - Header Part

Basics of a RSS Feed
RSS Feed Sample
Basic Setup of an RSS ASP File
This site needs an editor - click to learn more!

Add Coding+a+RSS+Feed+%2D+Body to Twitter Add Coding+a+RSS+Feed+%2D+Body to Facebook Add Coding+a+RSS+Feed+%2D+Body to MySpace Add Coding+a+RSS+Feed+%2D+Body to Del.icio.us Digg Coding+a+RSS+Feed+%2D+Body Add Coding+a+RSS+Feed+%2D+Body to Yahoo My Web Add Coding+a+RSS+Feed+%2D+Body to Google Bookmarks Add Coding+a+RSS+Feed+%2D+Body to Stumbleupon Add Coding+a+RSS+Feed+%2D+Body to Reddit




RSS | Related Articles | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map


For FREE email updates, subscribe to the ASP Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor


Content copyright © 2014 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.

g


g features
Best uses for RSS

RSS and its future.

Force Download Dialog box with ASP

Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Poetry
Daily
Weekly
Monthly
Less than Monthly



BellaOnline on Facebook
g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2014 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor