g
Printer Friendly Version

editor  
BellaOnline's ASP Editor
 

RSS Job Board Sample

In this article, I am going to show you how to setup a RSS Feed for a job board. Let’s say that you have a number of jobs and you want to make them available for users to view using a RSS reader. Let’s also say that you need to add new jobs every day and instead of relying on users to come back and check everyday, you can setup the RSS feed that will automatically update and their RSS reader will obtain.

So, let’s go over the requirements.

Now, once you have the above
requirements met, we can move on to actually creating the RSS feed that will
post the new jobs.


I am going to show you how I
do mine. I need to add a new job in which I have written below:




Job Owner: Christopher Combs

Job Title: ASP Developer

Company: Web Dev Inc.

Date Created: 10/2/2006

Short Description: ASP
Developer needed in Newport Beach California.

Long Description: ASP
Developer position open in Newport Beach California. The requirements needed are
strong experience with ASP, SQL, HTML and other web based technologies. You will
be in charge of developing an internal website, also known as an intranet, to
allow internal users to view company information and to centralize documents and
other important information. This job requires 2 years experience with the above
mentioned technologies. Contact us now at

asp@bellaonline.com


NOTE: THIS IS NOT A REAL
JOB!!! THIS IS ONLY FOR DEMONSTRATION PURPOSES ONLY!!



Now, we are going to assume
that I have already added this to my database. So lets move on to the RSS File
itself. Make sure you replace the Connection String with yours. My date format
looks like this: 20061002 and I will post an article describing how to format
your dates properly so they will be easily sorted. Now, to the file:



<?xml version="1.0" encoding="ISO-8859-1"?>
<% Response.Buffer = true
Response.ContentType = "text/xml"
Function ApplyXMLFormatting(strInput)
if len(strInput) > 0 then
strInput = Replace(strInput,"&", "&")
strInput = Replace(strInput,"'", "'")
strInput = Replace(strInput,"""",""")
strInput = Replace(strInput, ">", ">")
strInput = Replace(strInput,"<","<")
else
strInput = ""
end if
ApplyXMLFormatting = strInput
End Function
%>
<rss version="2.0">
<channel>
<title>RSS Job Board - ASP</title>
<link>http://asp.bellaonline.com</link>
<description>RSS Job Board for ASP Developers</description>
<language>en-us</language>
<copyright>Copyright 2006</copyright>
<lastBuildDate><%=Now()%></lastBuildDate>
<ttl>20</ttl>
<image>

<url>http://www.bellaonline.com/images/bella.gif</url>
<title>ASP @ BellaOnline.com</title>
<link>http://asp.bellaonline.com</link>
</image>
<%
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
objConn.ConnectionString =

"Provider=sqloledb;Data Source=DBSERVER;Initial Catalog=ARTICLEDB;User Id=sa;Password=sqlpassword;"

objConn.CursorLocation = 3
objConn.Open
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>" & _

objRS("Message").Value
%>

<item>
<title><%=ApplyXMLFormatting(objRS("ShortDesc").Value)%>
</title>
<link>http://asp.bellaonline.com</link>
<description><%=ApplyXMLFormatting(strDesc)%></description>
<guid><%=objRS("ID")%></guid>
<datePosted><%=objRS("DateAdded")%></datePosted>
<webMaster>asp@bellaonline.com
(Christopher Combs)</webMaster>

<author><%=objRS("Owner")%></author>
<comments>http://asp.bellaonline.com</comments>
<pubDate><%=objRS("DateAdded")%></pubDate></item><%
objRS.MoveNext
Loop
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%></channel></rss>
That is it! Save the file as
rssfeed.asp and run it in a browser and it should come up with the information.
If you copy the link into your RSS Reader, it will display the jobs into the
window for you to view. You can then click the Read more to view the job in
detail.



To see what the XML format
will look like, copy this link into your web browser and you can see:

http://secureconditions.com/rssfeed.asp
then to test it in your reader, copy
the link and add it to the feed list.




If you have any questions or
comments on this article, please do not hesitate to let me know. If you are
stuck, drop me a line and I will assist in any way I can.

ASP Site @ BellaOnline
View This Article in Regular Layout

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



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


BellaOnline Editor