New website
Welcome to my new website design. I've decided to switch away from Drupal and move to a site written myself using PHP and MySQL on the backend, with HTML, JavaScript and CSS on the front end. Drupal was large, clunky, never did quite what you wanted when you installed a modification and I continually had to keep up with a stream of security updates!
One of the main objectives for the new website is easier maintainability: I don't have hours to keep it up to date every day, so I wanted to make it so it would keep itself up to date. You may be wondering how a website can keep itself updated automatically, with no intervention from the author.
With the advent of social networking and Web 2.0 websites, we are now storing, and frequently updating, large amounts of information about us on the web. Every day many people frequently use these services ranging from micro-blogging websites such as Twitter to photo-sharing websites such as Flickr.
Putting a smart website with the APIs of these services together will allow that website to be continually up to date, with new tweets, photos, links and anything else you can get from a web service. This removes a lot of work for the author of the website, and everyone is lazy, so it seems particularly appealing.
However, a considerable amount of effort needs to go into this. As well as writing the code for the website, you also need to write code to interface with the APIs of each service. All the APIs are usually completely different and you need to take a considerable amount of time into learning them. Additionally, you need to register for an API key for your website, and hope that it'll continue to work in the future! And of course, older versions of the API will eventually emerge, and you'll probably need to rewrite some of your code if this is the case.
What if there was some sort of unified, global and free API for accessing all these other APIs? You might think that such an API does not exist, however, Yahoo have done a great job in creating YQL, the Yahoo Query Language.
YQL allows you to access all these APIs with an SQL-type syntax to send your query to their servers. You can choose to receive the results in XML and JSON which make it very convenient to parse.
In fact, this makes it so easy, that a little function like this is all you need to run a YQL query and parse it in PHP:
function yql_query($qry) {
return json_decode(file_get_contents("http://query.yahooapis.com/v1/public/yql?q=" . urlencode($qry) . "&format=json&diagnostics=false&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys"));
} Using this new function is also relatively easy: to find a popular delicious link, you could write the following PHP:
$results = yql_query("select * from delicious.feeds.popular");
echo("A popular delicious link is: <strong>" . $results["query"]["results"]["item"][0]["link"] . "</strong>."); YQL is the technology that is now working on the backend of this site to fetch the recent photos, links and tweets. I will be continuing this article as part of a mini-series on how I built the new website design with topics such as jQuery, (even more) YQL and MetaWeblog.
Comments
Just a test comment for the website's new comments system. Do you like it?
Graham Edgecombe
24 December 2009
This new website looks good.
Shan Shazad
24 December 2009
Hmmm :/
Jonathan Edgecombe
25 December 2009