Use ColdFusion's CFFeed to Display Your Twitter Tweets (and more!) on Your Blog in 30 Seconds
As Twitter's popularity continues to increase, users and consumers of the information being broadcast are looking for quick and easy ways to integrate some of the information into their own content. So I whipped up this short, but sweet, example of how easy it is to repurpose content from Twitter using just a dash of ColdFusion.
First things first though, what makes consuming information from Twitter so easy is their search functionality. Check it out at http://search.twitter.com. By following the instructions there, you will see that anything you search for can be "burned" via RSS. After your search, following the link "Feed for this query" and viola! Instant RSS feed you can now consume. How sweet it is.
What's really cool is that if you search for let's say "stevewithington" you can see not only my posts, but also any responses too. If you only want to see tweets "from" me for example, then you simply put "from:" in front of your search criteria such as "from:stevewithington."
For sake of simplicity, I'm going to just follow the "Feed for this query" link and continue on.
If you're using ColdFusion 8, then all you have to do is use CFFeed to consume the feed. Here's a sample line of code:
<cfset feedurl="http://search.twitter.com/search.atom?q=from%3Astevewithington" />
<cffeed
source="#feedurl#"
properties="feedmeta"
query="feeditems" />
If you're curious as to what the feed contains, you can always use CFDump to find out:
<cfdump var="#feeditems#" label="feedItems" />
Using the above line of code, you should see something similar to the following:
As you'll see, CFFeed creates a very nice query object containing quite a bit of information for you. One field of interest at this point is the "CONTENT" field which contains HTML-formatted code for each tweet. If you prefer a "text-only" version of the tweet, then simply use the "TITLE" field. So, to show how easy this is, let's just loop over the feed items and output the "CONTENT."
<ol>
<cfoutput query="feeditems">
<li>#content#</li>
</cfoutput>
</ol>
Running the above line of code, you should see something like this:
I know, I know, you're probably thinking, "there's got to be more to it, right?" Well, there is if you want there to be! Using CFDump, you saw all kinds of information you can repurpose to your heart's desire. Think up new ways to use Twitter and with ColdFusion's CFFeed you can create new ways to consume it's easy-to-integrate-and-embed information.
Good to know, thanks for sharing!
The links will only show up if there are links in the Tweets. Here's another completed sample you can try:
<cfset feedurl="http://search.twitter.com/search.atom?q=from%3Aste...; />
<cftry>
<cffeed
source="#feedurl#"
properties="feedmeta"
query="feeditems" />
<cfcatch></cfcatch>
</cftry>
<cfoutput><ul style="text-align:left;"></cfoutput>
<cftry>
<cfoutput query="feeditems" maxrows="4">
<li align="left">#content#</li>
</cfoutput>
<cfcatch></cfcatch>
</cftry>
<cfoutput></ul></cfoutput>
Question: Any idea how to format that date that is returned? or better yet a east way to display it as "posted X minutes/hours/days ago"?
Thanks in advance for any feedback!
Keep up the good work.
Figured out the time stamp coming in (PUBLISHEDDATE) from the feed is in ISO 8601 format.
2009-06-04T02:09:38Z
This is what I did to format it (warning it ain't pretty):
<cfset pDate = Mid(PUBLISHEDDATE, 1, Find("T", PUBLISHEDDATE)-1)>
<cfset pTime = Mid(PUBLISHEDDATE, Find("T", PUBLISHEDDATE)+1, 8)>
<cfset pDateTime = "#pDate# #pTime#">
<cfset published = DateConvert("utc2Local",pDateTime)>
#DateFormat(published, 'm/d/yyyy')# at #TimeFormat(published, 'short')#
Let me know if you know of a better way or you see an issue to using the above method.
Thanks!
Thanks for posting the solution to your original question. Ray's script looks like a winner!
Thanks again.
http://www.bennadel.com/blog/811-Converting-ISO-Da...
Thanks all.
So simple with CFFeed. Happy that you shared this tip. You have a new follower.
Bob L.
That's interesting... the only thing I could suggest is to check twitter's search to make sure the feed works. I would assume it has something to do with Twitter.
Check here: http://search.twitter.com/advanced
Oddly though, when I enter IR_training in the 'From this person' field, and then click search, I get nothing. However, if I enter my name 'stevewithington' I do get results.
https://getbusinessstrategy.com/
https://growhealthexperts.com/
https://healthmaintaintips.com/
https://travelwithtouragent.com/
https://travelsmartvacation.com/
https://shareeducatonideas.com/
https://educationcareeronline.com/
https://geteducationskills.com/
https://gettechexpert.com/
https://trendingtechhere.com/
https://theshoppingaround.com/
https://getfashionskills.com/
<a href="https://www.viralhub24.com">St Andrews Day</a>
<a href="https://www.viralhub24.com">St Andrews Day Scotland</a>
St Andrews Day
St Andrews Day Food
St Andrews Day Scotland
that is my first era go to right here. From the heaps of clarification a propos your
articles,I bet i am not unaccompanied one having all of the entertainment proper here!
<a href="https://www.viralhub24.com">St Andrews Day Scotland</a>
Wishes and Sayings, by famous authors, celebrities to give you the perfect kick-start
for the week ahead. Enjoy a relaxed Sunday with a smile! If you wish to share more
inspirational quotes on Monday, take a look at our Inspirational Monday Morning Quotes.
<a href="https://www.extraprog.com/category/download-comput...;????? ?????</a>
for perceiving the central role of blacks in U.S. history.
<a href="https://etandoz.com/black-history-month/">... History Month 2020</a>
for the birthday events of Confederate commanders Robert E. Lee and Thomas J.
https://www.alizasolutions.com/logo-design-service...
Garmin Striker 4 Built-in GPS Fish Finder, is found to be one of the best fish finder brand GPS. It’s comparatively small with other fish finders but still, it does its job perfectly. Each and everything will be clear to you due to its high colour contrasts and brightness. The good thing about it is you can mark your hot spots to make fish catching easier for you regardless of whether you are in open water or in the lake.
https://bestfishfinderreviewz.com/
Garmin Striker 4 Built-in GPS Fish Finder, is found to be one of the best fish finder brand GPS. It’s comparatively small with other fish finders but still, it does its job perfectly. Each and everything will be clear to you due to its high colour contrasts and brightness. The good thing about it is you can mark your hot spots to make fish catching easier for you regardless of whether you are in open water or in the lake.
https://bestfishfinderreviewz.com/
Bona Mega Wood Floor Finish, is a floor finish specially designed for wood floors. RUST-OLEUM Varathane Enhancing the natural beauty of the floor and retaining its original color, it provides maximum shine and makes your floor look good as new. This is a clear liquid that gives extraordinary clean and clear finish to the floors leaving it bright and sparkly.
http://waterbasedpolyurethane.com/
<a href="https://www.viralhub24.com/top-hindi-songs/"&... Hindhi Songs</a>
<a href="https://www.darknessrisesgame.com/"chirstams qoutes</a>
Website primary care : <a href="https://www.indusmedicalassociates.com/"> www.indusmedicalassociates.com/ </a>
Thanks for sharing
<a href="https://www.florenceresidencecondo.sg">Flo... Residence</a>
<a href="https://www.one-bernams.com">One Bernam</a>
<a href="https://www.theavenue-southresidences.com">... South Residence</a>
<a href="https://www.thesengkang-grandresidences.com"&... Grand Residences</a>
https://attestationuae.com