<script src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({
version: 2,
type: 'profile',
rpp: 20,
interval: 4000,
width: 'auto',
height: 300,
theme: {
shell: {
background: '#e1e1e1',
color: '#0e89c7'
},
tweets: {
background: '#ffffff',
color: '#444444',
links: '#6c8711'
}
},
features: {
scrollbar: true,
loop: false,
live: true,
hashtags: true,
timestamp: true,
avatars: false,
behavior: 'all'
}
}).render().setUser('xxxxxxxxxxx').start();
</script开发者_如何转开发>
I don't know why but sometimes it does not render.
someone could tell me why?
thanks.
It's quite possible that Twitter itself could be down, Twitter's API could be down, your API limit (number of requests) has been reached, or that twimg.com is down (as of this posting, twimg.com is down for me).
The first thing your script does is load js from twimg.com. You can try to save that file locally, and just run it from your server instead of twimg... there's a chance it might still work, and it wouldn't require your site to hit twimg.com each time (then again, I don't know this particular widget).
While the widget approach is pretty easy, Twitter has a pretty easy API that you can interact with yourself, if you feel like reducing the number of servers in the equation. For example, this will get you a bunch of json data for a user:
http://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=some username
To "properly" do this, you'll want some kind of caching system in place so that you don't constantly ping twitter each time someone visits your site. For this, you'll have to get dirty with a little server-side code, such as PHP. It's not that bad to learn though, and there are lots of tutorials on how to do it.
Good luck!
精彩评论