I’m twitting again

Yeah!! Twitter have reactivated my account :D. Good news!!

I’ve written a patch for my wordpress theme and now it reads the caption from twitter :D. I still have to fix some performance problems, but… here it goes:

require_once 'XML/Feed/Parser.php';
$feeds = fopen('http://twitter.com/statuses/user_timeline/26378338.atom','r');
$source = "";
if ($feeds) {
	while ($s = fread($feeds, 1024)) {
		$source .= $s;
	}
}
$feed = new XML_Feed_Parser($source,false,true,true);
$first_entry = $feed->getEntryByOffset(0);
$title = $first_entry->title;
$little_title = substr($title, 13, 30);
$little_title .= (strlen($title) > 43) ? '...' : '';
print "<a href=\"http://www.twitter.com/capitangolo\">$little_title</a>";

Updated:

Thanks to: http://remysharp.com/2007/05/18/add-twitter-to-your-blog-step-by-step/. Now my tweets are loaded by javascript, so my blog loads much fast :D.

Publicado por

GoLo

Bored of Universisty, I began to learn by my self trying to improve my skills. Then I met programming, Java and Linux. When I have some time, I work on my personal projects.

Deja un comentario

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.