This has been confirmed to work with version 4.5 of Umbraco
Description
This package allows you to display your recent tweets from Twitter.
New in Version 2.0
- [Lee K] Added Twitter Search macro.
- [Lee K] Added .NET controls to embed tweets directly into your website (a la Blackbird Pie).
- [Warren B] Updated Twitter Status XSLT with new Twitter REST API to fix long load times
New in Version 1.6
- Use the NEW Twitter API
- Support for enabling/disabling native RTs in the stream
New in Version 1.5
- Google Static Maps API no longer needs an API key so this macro parameter has been removed
- Better commenting of XSLT file
- Few tiny tweaks to markup
- Verified to work with Umbraco version 4.5
- Fixed bug - When showing only your tweets and limiting to a specific number. Where before if your last 5 tweets were @replies nothing would be displayed.
Installation
- Download the package (zip file) to your machine
- Login to your umbraco install and goto the developer section
- Expand the packages folder
- Select install local package and point to zip file you just downloaded
- Wait for the install to finish
- Insert the [XSLT] CWS - Twitter macro into your template
- Fill in parameters for the macro
- Ammend the XSLT to suit your XHTML needs
- VOILA - Your done !
Installs the following files
- bin/CWS.Twitter4Umbraco.XSLTExtensions.dll
- xslt/CWS_twitter.xslt
The actual package installs the following into umbraco:
- Macro: [XSLT] CWS - Twitter
- XSLT: CWS_twitter.xslt
- Registers the DLL as an XSLT Extension in /config/XSLTExtensions.config
Macro Parameters
- Twitter Username - Your twitter username of the account you wish to display tweets from
- Number of Statuses - The number of statuses you want to display (Upto 200)
- Display @ Replies? - If you wish to show tweets, where you are replying to a user
- Display Google Maps? - If you wish to display google maps for geo encoded tweets
- Google Maps - Zoom Level - Zoom level of the map (0 to 21)
- Google Maps - Map Size - Size of the map in pixels (eg: 500x500)
- Google Maps - Map Type - The type of map (roadmap, satellite, hybrid ,terrain)
For info about the Google Static Maps API
http://code.google.com/apis/maps/documentation/staticmaps/
Editing the markup
Open up CWS_twitter.xslt and edit only the markup inside this template:
<xsl:template match="status" mode="tweet"> <!-- Change the XHTML here for how you want each tweet to be displayed --> <div> <p> <img src="{user/profile_image_url}" /> <strong> <xsl:value-of select="user/name"/> </strong> - <xsl:value-of select="umbraco.library:FormatDateTime(CWS.Twitter:FormatTwitterDate(created_at), 'ddd d MMM yy @ H:mm')"/> <xsl:value-of select="CWS.Twitter:FormatUrls(text)" disable-output-escaping="yes"/> </p> <!-- Show Map of Tweet - IF value there & user enabled maps --> <xsl:if test="geo/georss:point != '' and $displayMaps = 1"> <p> <!-- Pass coordinates to map template--> <xsl:call-template name="map"> <!-- Google wants coordinates as comma seperated so replace (space) with comma --> <xsl:with-param name="coordinates" select="umbraco.library:Replace(geo/georss:point,' ',',')" /> </xsl:call-template> </p> </xsl:if> </div></xsl:template>
Example Status XML
If you wish to add further fields to your output I have included below a copy of the XML that twitter returns for each tweet.
Example Status XML - Geo
Below is an example of the XML that twitter returns for each tweet with additional Geo information
<status> <created_at>Wed Aug 25 19:40:45 +0000 2010</created_at> <id>22113974549</id> <text>Sending out a geo tagged tweet as a test to update the twitter for #umbraco package to the new API from twitter</text> <source><a href="http://twitter.com/" rel="nofollow">Twitter for iPhone</a></source> <truncated>false</truncated> <in_reply_to_status_id></in_reply_to_status_id> <in_reply_to_user_id></in_reply_to_user_id> <favorited>false</favorited> <in_reply_to_screen_name></in_reply_to_screen_name> <retweet_count></retweet_count> <retweeted>false</retweeted> <user> <id>9751992</id> <name>Warren Buckley</name> <screen_name>warrenbuckley</screen_name> <location>iPhone: 51.559616,0.592538</location> <description>A web developer who is based in the UK that works for Norwegian Web Agency Xeed - http://www.xeed.no</description> <profile_image_url>http://a3.twimg.com/profile_images/696762619/warren-buckley_normal.jpg</profile_image_url> <url>http://www.creativewebspecialist.co.uk</url> <protected>false</protected> <followers_count>557</followers_count> <profile_background_color>022330</profile_background_color> <profile_text_color>333333</profile_text_color> <profile_link_color>0084B4</profile_link_color> <profile_sidebar_fill_color>C0DFEC</profile_sidebar_fill_color> <profile_sidebar_border_color>a8c7f7</profile_sidebar_border_color> <friends_count>257</friends_count> <created_at>Sun Oct 28 11:44:59 +0000 2007</created_at> <favourites_count>974</favourites_count> <utc_offset>0</utc_offset> <time_zone>London</time_zone> <profile_background_image_url>http://s.twimg.com/a/1282351897/images/themes/theme15/bg.png</profile_background_image_url> <profile_background_tile>false</profile_background_tile> <profile_use_background_image>true</profile_use_background_image> <notifications>false</notifications> <geo_enabled>true</geo_enabled> <verified>false</verified> <following>true</following> <statuses_count>7772</statuses_count> <lang>en</lang> <contributors_enabled>false</contributors_enabled> <follow_request_sent>false</follow_request_sent> <listed_count>55</listed_count> <show_all_inline_media>false</show_all_inline_media> </user> <geo xmlns:georss="http://www.georss.org/georss"> <georss:point>51.5596798 0.59269702</georss:point> </geo> <coordinates xmlns:georss="http://www.georss.org/georss"> <georss:point>51.5596798 0.59269702</georss:point> </coordinates> <place xmlns:georss="http://www.georss.org/georss"> <id>433a0c1e74bddb9e</id> <name>Castle Point</name> <full_name>Castle Point, Essex</full_name> <place_type>city</place_type> <url>http://api.twitter.com/1/geo/id/433a0c1e74bddb9e.json</url> <attributes/> <bounding_box> <georss:polygon>51.500769 0.5157113 51.500769 0.703401 51.5877718 0.703401 51.5877718 0.5157113</georss:polygon> </bounding_box> <country code="">United Kingdom</country> </place> <contributors/></status>
Example Status XML - Native RT
Below is an example of the XML that twitter returns for each tweet with additional RT information
<status> <created_at>Wed Aug 25 19:20:30 +0000 2010</created_at> <id>22112745181</id> <text>RT @leekelleher: Any #umbraco devs want to help on an ELMAH package? Need help with package action, (not enough hours in the day!) http: ...</text> <source><a href="http://www.tweetdeck.com" rel="nofollow">TweetDeck</a></source> <truncated>true</truncated> <in_reply_to_status_id></in_reply_to_status_id> <in_reply_to_user_id></in_reply_to_user_id> <favorited>false</favorited> <in_reply_to_screen_name></in_reply_to_screen_name> <retweet_count></retweet_count> <retweeted>false</retweeted> <retweeted_status> <created_at>Wed Aug 25 17:16:13 +0000 2010</created_at> <id>22105108358</id> <text>Any #umbraco devs want to help on an ELMAH package? Need help with package action, (not enough hours in the day!) http://bit.ly/9nu4G0</text> <source><a href="http://www.twhirl.org" rel="nofollow">Seesmic twhirl</a></source> <truncated>false</truncated> <in_reply_to_status_id></in_reply_to_status_id> <in_reply_to_user_id></in_reply_to_user_id> <favorited>false</favorited> <in_reply_to_screen_name></in_reply_to_screen_name> <retweet_count></retweet_count> <retweeted>false</retweeted> <user> <id>1005461</id> <name>Lee Kelleher</name> <screen_name>leekelleher</screen_name> <location>Yatton, Bristol, UK</location> <description>Umbraco MVP 2010 and ASP.NET developer.</description> <profile_image_url>http://a2.twimg.com/profile_images/56197478/northbynorthwest_300x300_normal.jpg</profile_image_url> <url>http://leekelleher.com/</url> <protected>false</protected> <followers_count>306</followers_count> <profile_background_color>709397</profile_background_color> <profile_text_color>333333</profile_text_color> <profile_link_color>1F98C7</profile_link_color> <profile_sidebar_fill_color>A0C5C7</profile_sidebar_fill_color> <profile_sidebar_border_color>86A4A6</profile_sidebar_border_color> <friends_count>184</friends_count> <created_at>Mon Mar 12 12:29:59 +0000 2007</created_at> <favourites_count>2</favourites_count> <utc_offset>0</utc_offset> <time_zone>London</time_zone> <profile_background_image_url>http://a3.twimg.com/profile_background_images/88106321/shark.jpg</profile_background_image_url> <profile_background_tile>true</profile_background_tile> <profile_use_background_image>true</profile_use_background_image> <notifications>false</notifications> <geo_enabled>true</geo_enabled> <verified>false</verified> <following>false</following> <statuses_count>2735</statuses_count> <lang>en</lang> <contributors_enabled>false</contributors_enabled> <follow_request_sent>false</follow_request_sent> <listed_count>50</listed_count> <show_all_inline_media>false</show_all_inline_media> </user> <geo/> <coordinates/> <place/> <contributors/> </retweeted_status> <user> <id>9751992</id> <name>Warren Buckley</name> <screen_name>warrenbuckley</screen_name> <location>iPhone: 51.559616,0.592538</location> <description>A web developer who is based in the UK that works for Norwegian Web Agency Xeed - http://www.xeed.no</description> <profile_image_url>http://a3.twimg.com/profile_images/696762619/warren-buckley_normal.jpg</profile_image_url> <url>http://www.creativewebspecialist.co.uk</url> <protected>false</protected> <followers_count>557</followers_count> <profile_background_color>022330</profile_background_color> <profile_text_color>333333</profile_text_color> <profile_link_color>0084B4</profile_link_color> <profile_sidebar_fill_color>C0DFEC</profile_sidebar_fill_color> <profile_sidebar_border_color>a8c7f7</profile_sidebar_border_color> <friends_count>257</friends_count> <created_at>Sun Oct 28 11:44:59 +0000 2007</created_at> <favourites_count>974</favourites_count> <utc_offset>0</utc_offset> <time_zone>London</time_zone> <profile_background_image_url>http://s.twimg.com/a/1282351897/images/themes/theme15/bg.png</profile_background_image_url> <profile_background_tile>false</profile_background_tile> <profile_use_background_image>true</profile_use_background_image> <notifications>false</notifications> <geo_enabled>true</geo_enabled> <verified>false</verified> <following>true</following> <statuses_count>7771</statuses_count> <lang>en</lang> <contributors_enabled>false</contributors_enabled> <follow_request_sent>false</follow_request_sent> <listed_count>55</listed_count> <show_all_inline_media>false</show_all_inline_media> </user> <geo/> <coordinates/> <place/> <contributors/></status>
Example Status XML - Previous versions
Below is an example of the XML that twitter returns for each tweet with previous versions (Older than version 1.6)
<status> <created_at>Wed Dec 09 10:45:26 +0000 2009</created_at> <id>6493042759</id> <text>Test tweet to check how geo info is stored Twitter XML.</text> <source><a href="http://www.atebits.com/" rel="nofollow">Tweetie</a></source> <truncated>false</truncated> <in_reply_to_status_id></in_reply_to_status_id> <in_reply_to_user_id></in_reply_to_user_id> <favorited>false</favorited> <in_reply_to_screen_name></in_reply_to_screen_name> <user> <id>9751992</id> <name>Warren Buckley</name> <screen_name>warrenbuckley</screen_name> <location>iPhone: 51.559616,0.592538</location> <description>A web developer who is based in the UK that works for Norwegian Web Agency Xeed - http://www.xeed.no</description> <profile_image_url>http://a1.twimg.com/profile_images/63253002/warren-buckley_normal.jpg</profile_image_url> <url>http://www.creativewebspecialist.co.uk</url> <protected>false</protected> <followers_count>426</followers_count> <profile_background_color>B2DFDA</profile_background_color> <profile_text_color>333333</profile_text_color> <profile_link_color>93A644</profile_link_color> <profile_sidebar_fill_color>ffffff</profile_sidebar_fill_color> <profile_sidebar_border_color>eeeeee</profile_sidebar_border_color> <friends_count>211</friends_count> <created_at>Sun Oct 28 11:44:59 +0000 2007</created_at> <favourites_count>393</favourites_count> <utc_offset>0</utc_offset> <time_zone>London</time_zone> <profile_background_image_url>http://s.twimg.com/a/1260214487/images/themes/theme13/bg.gif</profile_background_image_url> <profile_background_tile>false</profile_background_tile> <statuses_count>5252</statuses_count> <notifications>false</notifications> <geo_enabled>true</geo_enabled> <verified>false</verified> <following>false</following> </user> <geo xmlns:georss="http://www.georss.org/georss"> <georss:point>51.559618 0.592546</georss:point> </geo></status>
Videos
Version 1.6 (Latest)
Refer to the version 1.5 videos, as 1.6 is only a minor release that adds an extra Macro parameter to allow you to enable/disable showing native RTs
Version 1.5
YouTube - http://www.youtube.com/watch?v=jtGHN4ULKsI
Vimeo - http://vimeo.com/13492803
Version 1.4
YouTube - http://www.youtube.com/watch?v=3g_7JDCuj-A
Vimeo - http://vimeo.com/8168025