Skip to content

Instantly share code, notes, and snippets.

@modius
Created October 18, 2009 05:07
Show Gist options
  • Save modius/212554 to your computer and use it in GitHub Desktop.
Save modius/212554 to your computer and use it in GitHub Desktop.
Sample RSS Feed type webskin
<cfsetting enablecfoutputonly="true" />
<!--- @@Copyright: Copyright (c) 2008 Daemon Pty Limited. All rights reserved. --->
<!--- @@displayname: RSS Feed--->
<!--- @@description: Type webskin for RSS feed for the latest blog posts in the Goog. --->
<!--- @@author: Geoffrey Bowers on 2008-12-15 --->
<!--- @@cacheStatus: 1 --->
<!--- @@cacheTimeout: 15 --->
<cfquery datasource="#application.dsn#" name="qPosts">
SELECT TOP 30 objectid, datetimepublished, description, title
FROM googBlogPost
ORDER BY datetimecreated DESC
</cfquery>
<!---<cfdump var="#qPosts#">--->
<cfset qFeed = queryNew("title, content, publisheddate, rsslink") />
<cfloop query="qposts">
<cfset queryaddrow(qFeed, 1) />
<cfset querysetcell(qFeed, "title", qPosts.title) />
<cfset querysetcell(qFeed, "content", abbreviate(qPosts.description, 300)) />
<cfset querysetcell(qFeed, "publisheddate", qPosts.datetimepublished) />
<cfset querysetcell(qFeed, "rsslink", application.fapi.getLink(objectid=qPosts.objectid, view="displayRedirect")) />
</cfloop>
<!--- Set the feed metadata. --->
<cfset stprop = StructNew() />
<cfset stprop.title = "Fullasagoog" />
<cfset stprop.link = "http://fullasagoog.com/" />
<cfset stprop.description = "The lastest goog flavoured blend, chock full of rich internet application goodness." />
<cfset stprop.version = "rss_2.0" />
<!--- Create the feed. --->
<cffeed
action="create"
query="#qFeed#"
properties="#stProp#"
xmlvar="rssXML" />
<cfcontent reset="true" /><cfoutput>#rssXML#</cfoutput>
<!---<cfdump var="#XMLParse(rssXML)#">--->
<cfsetting enablecfoutputonly="false" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment