The Right Way To Display Your Twitter Status

cover3

I wanted to add my latest Twitter status to the header of my blog, and all the solutions I found we’re a pain in the ass.

Then I messaged @ketzusaka to fix an issue (my stupid fault)… And he laughed at me. The code I was using was, without HTML, at least 30 lines long and not reliable. In about 30 seconds, he send this little snippet over to me -

$tweets = simplexml_load_string(file_get_contents("http://twitter.com/statuses/user_timeline/bigrobby.xml")); echo ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","\\0", $tweets->status[0]->text);

Then I styled it up so it looks like this on my blog.

status

How To Add Twitter Status To Your Blog

  • Download the Download the file (Twitter-Status.zip, 5k);
  • Modify Edit your user info and icon info in the top of the file.
  • Copy and paste wherever you want!

That’s it! Any questions, just leave a comment!

——————————————————————–

Tags: , , ,

  • haha thanks for this! with a little modification it works nicely on my blog
blog comments powered by Disqus