Here is some script I customised to show the last 5 Twitter entries. It is based on Jon Aquino's code, but made to display 5 items. I loaded it into Typepad Notes (which enables HTML code).
The result looks like this:
...I have uploaded some code for Twitter at http://my.agoge.net 10 mins ago
..."Come to the edge. We might fall. Come to the edge. It's too high! Come to the edge! And they came, and he pushed...... and they flew." 2 days ago
The code is:
<script type="text/javascript">
function twitterCallback(obj) {
var id = obj[0].user.id;
var html = '';
html += '...' + obj[0].text + '<span style="font-size: 0.6em;"> (' + obj[0].relative_created_at + ')</span></br>';
html += '...' + obj[1].text + '<span style="font-size: 0.6em;"> (' + obj[1].relative_created_at + ')</span></br>';
html += '...' + obj[2].text + '<span style="font-size: 0.6em;"> (' + obj[2].relative_created_at + ')</span></br>';
html += '...' + obj[3].text + '<span style="font-size: 0.6em;"> (' + obj[3].relative_created_at + ')</span></br>';
html += '...' + obj[4].text + '<span style="font-size: 0.6em;"> (' + obj[4].relative_created_at + ')</span></br>';
document.getElementById('my_twitter_status').innerHTML = html;
}
</script>
<span id="my_twitter_status"></span> <span id="my_twitter_status_time"></span>
<script type="text/javascript" src="http://www.twitter.com/t/status/user_timeline/1368091?callback=twitterCallback&count=5"></script>
Warning:
- You must have at least 5 notes in twitter for it to work.
- You must change your user id number (Shown in red above)
Have fun. Post a comment if you find it helpful.
I put your code at: www.wallawallawinenews.com/twittertest.htm but it only displayed a blank page with error. I changed your line of code:
"http://www.twitter.com/t/status/user_timeline/wwwinenews?callback=twitterCallback&count=5", replaced "/t/status/" with "/statuses/" and now the tweets display fine except the time is shown as "(undefined)".
How do I fix this latest issue?
Thanks,
Michael
Posted by: Michael | May 26, 2009 at 02:17 PM
I had a quick play with it but can't get it to work sorry.
I orginally got the code from http://jonaquino.blogspot.com/2006/12/twitter-increasing-number-of-twitters.html
and updated it. You could try that. I havent been using the code for a year or so, so twitter may have changed some of there fields??
Sorry could be of more help
Posted by: Andrew Nicol | May 27, 2009 at 07:12 AM