CodeGarden 10: The sixth annual Umbraco Developer Conference
June 23-25th 2010 - free ASP.NET MVC pre-conference. Register today!

Twitter for Umbraco

Version: 1.4, Beta

Download Twitter for Umbraco, 1.4

Project Summary

Project owner:
Warren Buckley
Created:
6/25/2009
Current version
1.4
License
MIT
Tags
widget  twitter  xslt extension  xslt 
Downloads:
176

Description
This package allows you to display your recent tweets from Twitter.

New in Version 1.4

  • Better RegEx for CWS.Twitter:FormatUrls with the help of @readingdancer
  • Support for displaying static Google Map for Geo encoded tweets.

Installation

  1. Download the package (zip file) to your machine
  2. Login to your umbraco install and goto the developer section
  3. Expand the packages folder
  4. Select install local package and point to zip file you just downloaded
  5. Wait for the install to finish
  6. Insert the [XSLT] CWS - Twitter macro into your template
  7. Fill in parameters for the macro
  8. Ammend the XSLT to suit your XHTML needs
  9. VOILA - Your done !

Installs the following files

  • bin/CWS.Twitter4Umbraco.XSLTExtensions.dll
  • bin/CWS.Twitter4Umbraco.XSLTExtensions.pdb
  • 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 - API Key - Your google maps API key
  • Google Maps - Zoom Level - Zoom level of the map
  • Google Maps - Map Size - Size of the map in pixels (eg: 500x500)
  • Google Maps - Map Type - The type of map (roadmap, satellite, hybrid ,terrain)

Registering for a Google Maps API Key & further info about the API
code.google.com/.../

 

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>
</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.

<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>&lt;a href=&quot;http://www.atebits.com/&quot; rel=&quot;nofollow&quot;&gt;Tweetie&lt;/a&gt;</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>

 

Upgrading to 1.4
Note: Some renaming has happened in 1.4 hence a few detailed steps

To upgrade to version 1.4 of the Twitter for Umbraco package follow these steps:

  • Download the twitter for umbraco 1.4 package (zip file)
  • Unzip the contents of the package file to your desktop or other convient place
  • Delete the DLL in your /bin folder called CWS.Twitter4Umbraco.XLSTExtensions.dll
  • Copy the DLL & PDB file from the new 1.4 unzipped folder to your /bin folder
  • Update the /config/xsltExtensions.config file with the following
    Note the fixed typo CWS.Twitter4Umbraco.XLSTExtensions now reads CWS.Twitter4Umbraco.XSLTExtensions
<ext assembly="/bin/CWS.Twitter4Umbraco.XSLTExtensions" type="CWS.Twitter4Umbraco.XSLTExtensions" alias="CWS.Twitter" />
  • Add the macro parameters to the Twitter Macro inside umbracro which are detailed further up
  • Then copy the XSLT file from the unzipped folder to your /XSLT folder
  • VOILA your done :)

If these upgrade instructions are not detailed enough or you need assitance, please use the forum's below for help.

====================================================================
Don't forget if you have used this and liked it please vote the project up.

====================================================================

Screenshots

Resources

Attached files

Package discussions

Help
5 topics, 21 posts
Use this forum if you have any problems using Twitter for Umbraco.
3 weeks ago by Warren Buckley
Feature Requests
3 topics, 13 posts
Please post your ideas/feature requests in this forum.
3 months ago by Warren Buckley