Category Archives: Coding

Count Your Retweets with the Tweetmeme API

I didn’t know this until recently, but Tweetmeme has an API for displaying the number of times and URL has been retweeted. A quick request to http://api.tweetmeme.com/url_info?url=[the URL] will return an XML, JSON or PHP response. You can pass the full URL as the argument, or a short URL that goes to the same place.

<result>
<status>success</status>
<story>
<title>Learning CSS Sprites</title>
<url>http://www.webmaster-source.com/2009/11/06/learning-css-sprites/</url>
<media_type>news</media_type>
<created_at>2009-11-06T11:51:30+00:00</created_at>
<url_count>25</url_count>
<tm_link>http://tweetmeme.com/story/257000589</tm_link>
<comment_count>0</comment_count>
<excerpt>Learning CSS Sprites http://bit.ly/3HlYUl</excerpt>
<thumbnail>http://tweetmeme.s3.amazonaws.com/thumbs/257000589.jpg</thumbnail>
</story>
</result>

If you want to see a quick example of how you can use the API, have a look at this WP Recipes snippet: Display the number of tweets for each page or post.

jParse: A jQuery XML Parser Plugin

jParse is a jQuery plugin that can asynchronously fetch an XML file (AJAX, in other words) and parse it for display. It works in all modern browsers, plus Internet Explorer 6+, and the file is only 1.8KB in size. It’s basic usage looks something…

How to Create a Basic “Retweet This” Link

Are you looking to create a simple link to retweet a page, but you don’t need a fancy Tweetmeme counter with it? Try something like this: When clicked, it takes the visitor to Twitter, where it fills-in the update box for you. Just be…

SimplePie Ceases Development

The developers behind the SimplePie RSS parser (the de facto standard for PHP RSS parsing) have announced that they are ending their work developing the project. …effective immediately, we are ceasing development of SimplePie and shutting down the project. We will shortly be pushing…

What Are the Advantages of a PHP Framework?

CodeIgniter. CakePHP. Kohana. There’s no shortage of PHP frameworks…but why should you use one? What are the major advantages? MVC – The Model-View-Controller architectural pattern helps you tier your code for easier maintenance. By keeping the data-manipulating logic separate from the bits that handle…

GetGravatar jQuery Plugin

GetGravatar is a jQuery plugin that is a perfect touch for blog comment forms. It monitors an email address form input, and makes an AJAX request to load a Gravatar. (See a demo.) This would enable you to show a user’s Gravatar next to…

Learning the Kohana PHP Framework

Net.Tuts+ has a good tutorial on the Kohana PHP framework. Following it through should get you used to the MVC structure, help you configure everything, and give you a good overall feel for the framework. Coupled with the official Kohana docs, you should be…

Kohana: Cleaner CodeIgniter For PHP 5

One of the major criticisms of the CodeIgniter PHP framework is its continued support for PHP 4. The developers of the language announced two years ago that PHP 4 development, security patches included, would cease by the end of 2007. The CodeIgniter project still…

PHP stdClass: Storing Data in an Object Instead of an Array

Have you ever seen a scenario where you’re accessing data as an object, such as when you’re using WordPress’s database interface or when you’re parsing XML files with SimpleXML? You have something like echo $result->name. Have you ever wondered how that was done? Using…

Using isset() Instead of strlen() in PHP

I found something interesting in an old Smashing Magazine article. The author describes a slightly faster alternative to the strlen() function in PHP, which is used to determine the length of a string variable. An interesting fact about PHP is that a string is…