This is a plugin I made for GetSimpleCMS. I am currently working on it and you can find it for download here.
<?phpfunction tumblr() { $feed = simplexml_load_file('http://yournamehere.tumblr.com/api/read?type=post&start=0&num=4'); $posts = $feed->xpath("/tumblr/posts/post"); foreach ($posts as $post) { echo '<div class="article">'; echo "<br/>"; echo '<h3 class="article_title">'.$post->{'regular-title'}. '</h3>'; echo '<p class="article_date">' .$post['date'].'</p>'; echo $post->{'regular-body'}; echo "<br/>"; echo '<a href="'.$post['url']. '">Read More</a>'; echo "</div>"; } } ?> <? tumblr() ?>
This sets up the function, and how how to use the function, simply put your tumblrname in where "yournamehere" is. I will update this further as I learn more. This was my first attempt at using xpath or simplexml where are all new to PHP since I learned it back in 2003-2004.
blog comments powered by Disqus Last updated: Friday, February 11th, 2011 - 12:58 AM
