Downloads

Here are some examples of how you can produce dynamic RSS job feeds from your jobs database, if there are other languages you would like to see on this page, or if you're haivng problems implementing, why not contact us?

ASP example - RSS feed

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet href="http://jobble.org/style.css" type="text/css"?>
<rss version="2.0">
<channel>
<title>jobs at exampleco</title>
<link>http://www.exampleco.com/jobs</link>
<description>Jobs working with exampleco</description>
<language>en-us</language>
<webMaster>jobsmaster@exampleco.com</webMaster>
<pubDate><%=now() %></pubDate>
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "Provider=sqloledb;SERVER=db.exampleco.com;DATABASE=jobs;UID=user;PWD=password"
set rs=Server.CreateObject("ADODB.recordset")

rs.Open "SELECT jobid, jobtitle, description,datemodified FROM jobs ", conn

do until rs.EOF

%><item><%Response.Write(chr(10))%><title><% response.write rs("jobtitle")%></title><%Response.Write(chr(10))%>
<link>http://www.exampleco.com/jobs/<%response.write rs("jobid")%>.htm</link><%Response.Write(chr(10))%>
<description><% response.write rs("decription")%></description>
<pubDate><% response.write day(rs("datemodified")) & " "& monthname(month(rs("datemodified"))) & " " & year(rs("datemodified"))%></pubDate><%Response.Write(chr(10))%></item><%

Response.Write(chr(13))
rs.MoveNext
loop

rs.close
conn.close
%>
</channel>
</rss>


Coldfusion example - RSS feed

Note, depending on how your coldfusion server is set up, you might need to wrap your applications.cfm in in order to avoid the "not at start of external entity" xml error.

<CFHEADER NAME="Content-Type" VALUE="text/xml"><?xml version="1.0" encoding="ISO-8859-1"?>
<cfquery name="get_jobs" datasource="#DB_DSN#" username="#DB_UID#" password="#DB_PWD#">jobid, jobtitle, description,datemodified, dateexpiry FROM jobs where datemodified<= GETDATE()and dateexpiry > GETDATE() order by datemodified desc</cfquery>
<rss version="2.0">
<channel>
<title>jobs at exampleco</title>
<link>http://www.exampleco.com/jobs</link>
<description>http://www.exampleco.com/jobs</description>
<language>en-us</language>
<webMaster>jobsmaster@exampleco.com</webMaster>
<pubDate><cfoutput>#dateformat(now(), "yyyy-mm-dd")#</cfoutput></pubDate>
<cfoutput>
<cfloop query="get_jobs">
<item>
<title>#jobtitle#</title>
<link>http://www.exampleco.com/jobs/#articleid#.htm</link>
<description>#description#<br/> Please apply before #dateformat(dateexpiry, "dddd mmmm yyyy")#</description>
<pubdate>#dateformat(datemodified, "yyy-mm-dd")#</pubdate>
</item></CFLOOP>
</CFOUTPUT>
</channel>
</rss>



PHP example - RSS feed

<?

// prepare HTML text for use as UTF-8 character data in XML
function cleanText($intext) {
return utf8_encode(
htmlspecialchars(
stripslashes($intext)));
}

header("Content-Type: text/xml;charset=utf-8");
$db = mysql_pconnect("server", "username", "password");

if (!$db)
{
error_log("Error: Could not connect to database");
exit;
}

// store items from the database in the $result array
mysql_select_db("jobs");

$result = mysql_query("select jobid, jobtitle, description, datemodified, dateexpiry FROM jobs");

// display RSS 2.0 channel information

ECHO <<<END
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>jobs at exampleco</title>
<link>http://www.exampleco.com/jobs/</link>
<description>Jobs working with exampleco</description>
<language>en-us</language>
END;

// loop through the array pulling database fields for each item
for ($i = 0; $i < mysql_num_rows($result); $i++) {
@$row = mysql_fetch_array($result);
$title = cleanText($row["title"]);
$link = "http://www.exampleco.com/jobs/".cleanText($row["jobid"]);
$description = cleanText($row["description"]);
$pubDate = date("r", strtotime($row["datemodified"]));

// display an item
ECHO <<<END

<item>
<title>$title</title>
<link>$link</link>
<description>$description</description>
<pubDate>$pubDate</pubDate>
</item>
END;

}

ECHO <<<END

</channel>
</rss>
END;

?>

Perl example
Most perl implementations use the XML:RSS module from CPAN, here's the best article perl RSS example we could find.

Python example
Python's pretty good at doing stuff like this, here's a good Python RSS example