Adding a Drupal Recent Tweets Block
These are the steps I took to add the recent tweets block you see on the right of my blog page.
1. Created a new block with the Title and Block Description, "Recent Tweets."
2. Pasted the following code into the Block Body. I originally found the code here.
<div id="twitter_div"> <ul id="twitter_update_list"></ul></div> <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script> <script text="text/javascript" src="http://twitter.com/statuses/user_timeline/juliakm.json?callback=twitterCallback2&count=2"></script>
Here is what you will need to change:
<div id="twitter_div"> <ul id="twitter_update_list"></ul></div> <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script> <script text="text/javascript" src="http://twitter.com/statuses/user_timeline/[Your Twitter Username].json?callback=twitterCallback2&count=[Number of Posts to Display]"></script>
3. Set the Input format to PHP Code.
4. Cleared the cache on my site using the Devel module.
5. Logged out and admired my block.


Thanks
This was brilliant. Worked Great. Also, for a side note, if you haven't already enabled the php code, you can do so my going to Modules > and finding the php one to enable it. I had to do that before this would work, so just in case anyone else doesn't see php code under input format, that's how it's done.
Check it out on my page: http://www.warep.com
A line missing
You missed the last line that will have the actual user name and json syntax call.
Thanks
Nice, but the original Twitter Javascript is not so optimal. I would prefer to cache tweets to prevent a slowdown of your site when Twitter is down
Post new comment