tags:

views:

1977

answers:

3

Hi, I would like to integrate my tumblr feed in to my website. It seems that tumblr has an API for this, but I'm not quite sure how to use it. From what I understand, I request the page, and tumblr returns an xml file with the contents of my blog. But how do I then make this xml into meaningful html? Must I parse it with php, turning the relevant tags into headers and so on? I tell myself it cannot be that painful. Anyone have any insights?

+1  A: 

You can use PHPTumblr, an API wrapper written in PHP which makes retrieving posts a breeze.

ChrisR
Godsent. Now to learn php...
Ying
+1  A: 

There are two main ways to do this. First, you can parse the xml, pulling out the content from the the tags you need (a few ways to do this depending on whether you use a SAX or DOM parser). This is the quick and dirty solution.

You can also use an XSLT transformation to convert the xml source directly to the html you want. This is more involved since you have to learn the syntax for xslt templates, which is a bit verbose.

Dana the Sane
A: 

There's a javascript include that does this now, available from Tumblr (you have to login to see it): http://www.tumblr.com/goodies

It winds up being som†ething like this:

<script type="text/javascript" src="http://{username}.tumblr.com/js"&gt;&lt;/script&gt;
kweerious