Combining Two RSS Feeds in CFScript

RSS TruckIn a previous post, I had written an example of combining two RSS feeds into one. At some point, I lost the code from the example, probably from clicking save one-too-many times in WordPress. WordPress is quite finicky about posting any kind of programming code. I did some research, and found PasteBin, and have started using that for my code samples.

With that out of the way, it’s time to rewrite the example that was lost, and to try it out in pure CFScript.

Code Walkthrough:

  • Use feed to Read a WordPress blog feed and return a Query object. If this fails, create an empty query object.
  • Execute an SQL Query to get recent News Stories from a MySQL database. If this fails, create an empty query object.
  • Use Query of Queries to create a Union of the two sources previously defined. If this fails, create an empty query object.
  • Setup Structs to defined properties for RSS Feed Creation
  • Create the RSS Feed. This one gave me a bit of grief. I didn’t see my output file until I added ExpandPath to it. It took be a bit to figure out that to get assign the results of the create method to the xmlVar. Adobe’s documentation is sketchy on this – no working example. After reading through the documentation a few times, I eventually figured it out.

http://pastebin.com/embed_iframe.php?i=67dZjsQi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s