Monday, February 2, 2009

Facebook app creation: A look at the MySQL Quiz. part I

The Facebook juggernaut is an interesting environment for application developers. It is well documented for the most part and supports all the popular development languages. So I created a quick app to help promote MySQL certification and gave it the name MySQLQuiz.

The first step in app development is at the bottom of every Facebook page. That is where you will find the 'Developers' link. The documentation here is very good and you will be be able to quickly obtain the application's API Key and the applications 'secret'. Each app is going to have unique values for these.

The examples I will give are in PHP and using the supplied PHP library. I was able to get all this running on a test server.

The bare bones was


require_once 'facebook.php';
$appapikey = "yourappapikeyhere";
$appsecret = "yourappsecrethere";
$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook->require_login();

echo "Hello world!";

?>


So after I got the bare minimum out of the way, I started going deeper into the documentation. Facebook has their own markup language FBML (think of it like pre-coded libraries for some interesting tools). These tags start with <fb: provide a lot of functionality for very little coding. You will see on the MySQLQuiz application a series of tabs that link to various MySQL pages.
<fb:tabs>
<fb:tab-item href='http://www.mysql.com/certification' title='MySQL Certification' selected='true' />
<fb:tab-item href='http://www.mysql.com/certification/selftest/core/index.php' title='Sample Certification Questions' />
<tb:tab-item href='http://www.mysql.com/training' title='MySQL Classes' />
</fb:tabs>



The above is probably enough to make a few of you go investigate Facebook app programming. My next post will include some more on the MySQLQuiz (how to randomly pick unique items from a database) and how the answers appear on the MySQLquiz.


And you can find the MySQLQuiz on Facebook by under the `Just For Fun` Applications

1 comment:

Felix said...

I can't wait to try this out, but I'm not having any luck finding this application on Facebook.