Atom and RSS feeds with ColdFusion 8 Chaz Chumley [email protected] What will be Covered     Understanding RSS Introducing the CFFeed tag Creating RSS Feeds Consuming RSS Feeds.

Download Report

Transcript Atom and RSS feeds with ColdFusion 8 Chaz Chumley [email protected] What will be Covered     Understanding RSS Introducing the CFFeed tag Creating RSS Feeds Consuming RSS Feeds.

Atom and RSS feeds
with ColdFusion 8
Chaz Chumley
[email protected]
What will be Covered




Understanding RSS
Introducing the CFFeed tag
Creating RSS Feeds
Consuming RSS Feeds
About the Presenter






8 yrs CF Experience
Application Developer – Lucidus.net
Author/Partner – CommunityMx.com
Instructor – University of Nevada Las Vegas
Adobe User Group Manager – Las Vegas
Frequent speaker: Conferences
Understanding RSS

What is an RSS or Atom feed
•
Really Simple Syndication
•
XML based format for sharing and distributing web content.
•
Viewing an RSS feed from the browser
•
Demo...
Introducing CFFeed

<cffeed>
•
Can create RSS 2.0 or Atom 1.0 feeds
•
Can read RSS versions 0.90,0.91,0.92,0.93,0.94,1.0 and 2.0 as
well as Atom 0.3 and 1.0
•
Attributes vary based on whether you are creating or reading a
feed
Creating RSS Feeds
✓ When you create a feed
•
•
You specify the feed data by:
1.
Placing all metadata and item in a single structure specified by the “name”
attribute
2.
Placing metadata in a structure specified by the “properties” structure and
the items as rows in a query object specified by the “query” attribute
You save the resulting feed XML by:
1.
A file specified by the “outputFile” attribute. The cffeed tag saves the data
in UTF-8 encoding.
2.
A variable specified by the “xmlVar” attribute
Creating RSS Feeds
✓ Creating a feed from a single item

Step 1 - create a structure containing a Feed title, link, description
and version. At least one item element must be created

Step 2 - Create feed with CFFeed tag

Demo...
<cffeed action = “create”
name = “#myFeed#”
outputFile = “myfeed.xml”
overwrite = “yes”
xmlVar = “myXML”>
Creating RSS Feeds
✓ Creating a feed from a query
•
Step 1 - Create your feed structure
•
Step 2 - Create your query
•
Step 3 - Map your query columns to the appropriate feed
attributes.
•
Demo...
<cffeed action = “create”
query = “#myQuery#”
meta = “#mystruct#”
columnMap = “#columnMap#”
outputFile = “myFeed.xml”
overwrite = “yes”xmlVar = “myXML”>
Consuming RSS Feeds
✓ When you read a feed
•
You can save the feed data in any combination:
1.
By saving all item data and metadata in a single structure with the “name”
attribute
2.
By saving items as rows in a query object with the “query” attribute
3.
By saving the metadata in a structure specified with the “properties”
structure
4.
By writing the feed XML in a file with the “outputFile” attribute
5.
By saving the feed XML in a ColdFusion XML variable with the “xmlVar”
attribute
6.
A variable specified by the “xmlVar” attribute
Consuming RSS Feeds



Ensure the RSS or Atom feed you are reading has a
proper XML structure
Simply specify the “source” attribute of the feed
Demo...
<cffeed action = “read”
source=”feed.xml”
name = “myFeed”>
Additional Resources

Adobe Documentation
•
ColdFusion 8 - CFFeed
http://livedocs.adobe.com/coldfusion/8/htmldocs/
Summary



Simple to create RSS feeds from queries
Can consume RSS and Atom feeds
Makes aggregating quick and fun
Questions: [email protected]