{"id":130,"date":"2005-11-01T13:58:58","date_gmt":"2005-11-01T20:58:58","guid":{"rendered":"http:\/\/blog.hotpepper.ca\/archives\/2005\/11\/rss-and-coldfusion\/"},"modified":"2005-11-01T13:58:58","modified_gmt":"2005-11-01T20:58:58","slug":"rss-and-coldfusion","status":"publish","type":"post","link":"https:\/\/siever.ca\/kim\/2005\/11\/01\/rss-and-coldfusion\/","title":{"rendered":"RSS and ColdFusion"},"content":{"rendered":"<p>RSS is rapidly becoming a popular format for providing content. It allows users to subscribe to bits of information, so they can be notified when new information has been posted.<\/p>\n<p>I&#8217;ve been tossing around the idea of implementing RSS at <a href=\"http:\/\/www.uleth.ca\/man\/\">work<\/a> lately, and wanted to do it with ColdFusion. I finally buckled down and put something together. Surprisingly, it was much easier to do that I thought it would be, and I ended up creating RSS feeds for news articles, upcoming events, and job opportunities.<\/p>\n<p>Here&#8217;s the process I used to create the RSS feed for job opportunities.<\/p>\n<p>The first thing in my CFM file is a block of code that makes sure no HTML outside of the cfoutput tag gets displayed:<\/p>\n<p><code>&lt;cfsetting enablecfoutputonly=\"yes\"&gt;<\/code><\/p>\n<p>Then the query:<\/p>\n<p><code>&lt;cfquery name=\"qCareers\" datasource=\"xxx\"&gt;<br \/>\n\tSELECT * FROM Careers<br \/>\n\tORDER BY Position<br \/>\n&lt;\/cfquery&gt;<\/code><\/p>\n<p>Then I implement a cfsavecontent tag. This makes sure that all the content between these two tags is saved as a variable. The closing tag appears later.<\/p>\n<p><code>&lt;cfsavecontent variable=\"theXML\"&gt;<\/code><\/p>\n<p>Then comes my output. It is important than the root tag in XML for an RSS feed is &#8220;channel&#8221;, that the title of the feed is in a &#8220;title&#8221; tag, feed description is in &#8220;description&#8221;, a link to the HTML content of the feed is in a &#8220;link&#8221; tag. As well, every item should be within an &#8220;item&#8221; tag, which also contains &#8220;title&#8221;, &#8220;description&#8221; and &#8220;link&#8221; tags. Not following that format will cause your RSS feed to fail.<\/p>\n<p>In addition, there must be an &#8220;rss&#8221; tag, and there must be no white space (including a new line) between the opening &#8220;cfoutput&#8221; tag and the &#8220;xml&#8221; tag.<\/p>\n<p><code>&lt;cfoutput&gt;&lt;?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?&gt;<br \/>\n&lt;rss version=\"2.0\"&gt;<\/code><\/p>\n<p><code>&lt;channel&gt;<br \/>\n\t&lt;title&gt;Faculty of Management - Jobs&lt;\/title&gt;<br \/>\n\t&lt;description&gt;Current Career Opportunities&lt;\/description&gt;<br \/>\n\t&lt;link&gt;http:\/\/www.uleth.ca\/man\/people\/jobs\/&lt;\/link&gt;<br \/>\n\t\t&lt;cfloop query=\"qCareers\"&gt;<br \/>\n\t\t&lt;item&gt;<br \/>\n\t\t\t&lt;title&gt;#Position#&lt;\/title&gt;<br \/>\n\t\t\t&lt;description&gt;#Details# &lt;cfif NOT IsDefined(\"StartDate\") OR StartDate DOES NOT CONTAIN \"1999\"&gt;Commences #DateFormat(StartDate,'dd mmmm yyyy')#.&lt;\/cfif&gt;&lt;\/description&gt;<br \/>\n\t\t\t&lt;link&gt;http:\/\/www.uleth.ca\/man\/jobs\/index.cfm?id=#RecordID#&lt;\/link&gt;<br \/>\n\t\t&lt;\/item&gt;<br \/>\n\t\t&lt;\/cfloop&gt;<br \/>\n&lt;\/channel&gt;<\/code><\/p>\n<p>Close the cfsavecontent tag, as previously mentioned.<\/p>\n<p><code>&lt;\/cfsavecontent&gt;<\/code><\/p>\n<p>Then output the variable that contains it all.<\/p>\n<p><code>&lt;cfcontent type=\"text\/xml\"&gt;<br \/>\n&lt;cfoutput&gt;#theXml#&lt;\/cfoutput&gt;<\/code><\/p>\n<p>Simply upload this file to your server somewhere, and add the following into the page where you want the RSS feed available.<\/p>\n<p><code>&lt;link rel=\"alternate\" type=\"application\/rss+xml\" title=\"RSS 2.0\" href=\"http:\/\/www.uleth.ca\/man\/rss\/jobs.cfm\" \/&gt;<\/code><\/p>\n<p>Simple as that.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>RSS is rapidly becoming a popular format for providing content. It allows users to subscribe to bits of information, so they can be notified when new information has been posted. I&#8217;ve been tossing around the idea of implementing RSS at work lately, and wanted to do it with ColdFusion. I finally buckled down and put [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1],"tags":[],"class_list":["post-130","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4NkW7-26","jetpack-related-posts":[{"id":7,"url":"https:\/\/siever.ca\/kim\/2004\/09\/02\/creating-vcs-files-in-coldfusion\/","url_meta":{"origin":130,"position":0},"title":"Creating VCS Files in ColdFusion","author":"Kim Siever","date":"2 September 2004","format":false,"excerpt":"One thing I have been trying for months to do on the Faculty of Management website is to create VCS files on the fly. VCS files are what Outlook and other calendaring software use to pass calendar items between each other. When I added an event to our database with\u2026","rel":"","context":"With 1 comment","block_context":{"text":"With 1 comment","link":"https:\/\/siever.ca\/kim\/2004\/09\/02\/creating-vcs-files-in-coldfusion\/#comments"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":100,"url":"https:\/\/siever.ca\/kim\/2005\/06\/23\/gmail-rss\/","url_meta":{"origin":130,"position":1},"title":"GMail RSS","author":"Kim Siever","date":"23 June 2005","format":false,"excerpt":"I just realised today that GMail has an RSS feed. It seems it only works on unread messages in the inbox, however. No read messages and no archived new messages.","rel":"","context":"In &quot;Google&quot;","block_context":{"text":"Google","link":"https:\/\/siever.ca\/kim\/category\/google\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":21,"url":"https:\/\/siever.ca\/kim\/2004\/09\/28\/database-integration-with-flash\/","url_meta":{"origin":130,"position":2},"title":"Database Integration with Flash","author":"Kim Siever","date":"28 September 2004","format":false,"excerpt":"Dennis\u00e2\u20ac\u2122 solution was exactly what I needed. Well, actually, not quite what I needed. His solution worked for getting the data from the database and importing it to Flash. That was the biggest hurdle. What it did not do was allow for importing separate records. So I modified it.","rel":"","context":"With 2 comments","block_context":{"text":"With 2 comments","link":"https:\/\/siever.ca\/kim\/2004\/09\/28\/database-integration-with-flash\/#comments"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":108,"url":"https:\/\/siever.ca\/kim\/2005\/07\/28\/ie7-beta-1\/","url_meta":{"origin":130,"position":3},"title":"IE7 Beta 1","author":"Kim Siever","date":"28 July 2005","format":false,"excerpt":"Dean, the guy responsible for IE7, announced yesterday that Windows Vista (and concurrently IE7) Beta 1 has been released. After reading the IE7 Technology Overview, I am please to see some of the new features that will be available in the new version of IE. tabbed browsing better user interface\u2026","rel":"","context":"In &quot;Browsers&quot;","block_context":{"text":"Browsers","link":"https:\/\/siever.ca\/kim\/category\/browsers\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4003,"url":"https:\/\/siever.ca\/kim\/2019\/11\/30\/tax-cuts-are-job-cuts-a-running-total\/","url_meta":{"origin":130,"position":4},"title":"Tax cuts are job cuts: a running total","author":"Kim Siever","date":"30 November 2019","format":false,"excerpt":"In this article, I will keep a running total of the number of public sector job losses in Alberta.","rel":"","context":"In &quot;Politics&quot;","block_context":{"text":"Politics","link":"https:\/\/siever.ca\/kim\/category\/politics\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2019\/11\/knife-316655_1280.jpg?fit=1200%2C794&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2019\/11\/knife-316655_1280.jpg?fit=1200%2C794&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2019\/11\/knife-316655_1280.jpg?fit=1200%2C794&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2019\/11\/knife-316655_1280.jpg?fit=1200%2C794&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2019\/11\/knife-316655_1280.jpg?fit=1200%2C794&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3591,"url":"https:\/\/siever.ca\/kim\/2019\/03\/09\/i-finally-found-a-job-that-accommodates-my-adhd\/","url_meta":{"origin":130,"position":5},"title":"I finally found a job that accommodates my ADHD","author":"Kim Siever","date":"9 March 2019","format":false,"excerpt":"The longest I\u2019ve ever worked at a job is 9 years. The next longest was 3 years. Beyond that, never more than a year. There have been at least twice where I\u2019ve had 3 jobs in one year. And my jobs are rarely related.","rel":"","context":"In &quot;ADHD&quot;","block_context":{"text":"ADHD","link":"https:\/\/siever.ca\/kim\/category\/adhd\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2019\/03\/office-932926_1920-1.jpg?fit=1200%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2019\/03\/office-932926_1920-1.jpg?fit=1200%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2019\/03\/office-932926_1920-1.jpg?fit=1200%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2019\/03\/office-932926_1920-1.jpg?fit=1200%2C800&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2019\/03\/office-932926_1920-1.jpg?fit=1200%2C800&ssl=1&resize=1050%2C600 3x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/siever.ca\/kim\/wp-json\/wp\/v2\/posts\/130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/siever.ca\/kim\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/siever.ca\/kim\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/siever.ca\/kim\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/siever.ca\/kim\/wp-json\/wp\/v2\/comments?post=130"}],"version-history":[{"count":0,"href":"https:\/\/siever.ca\/kim\/wp-json\/wp\/v2\/posts\/130\/revisions"}],"wp:attachment":[{"href":"https:\/\/siever.ca\/kim\/wp-json\/wp\/v2\/media?parent=130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/siever.ca\/kim\/wp-json\/wp\/v2\/categories?post=130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/siever.ca\/kim\/wp-json\/wp\/v2\/tags?post=130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}