Building Facebook and Facebook Connect application with Codeigniter – Setup
Developing for Facebook is quite simple and easy if you have the right components. I used Codeingniter as a base framework for a few Facebook applications and that works pretty well . I had to do some little tweaking though.
This entry is not about how to build a Facebook application in Codeigniter, its more like the things that I have done to get it going...
I named my controller “fbook”. Very important as the Facebook library is “Facebook” under “application/libraries/”
The “Facebook” PHP client comes with 3 main files,
1. facebook_desktop.php
2. facebookapi_php5_restlib.php
3. facebook.php
We need to create a CI library from these 3 files and the “jsonwrapper”. Create a “facebook-clinet” folder under “application/libraries” folder. Copy paste all the files from the Facebook API library except “facebook.php” to this newly created folder. Rename the “facebook.php” file to “Facebook.php” and place it under “application/libraries” folder. Add the following line to the “Facebook.php” file
include_once 'facebook-client/facebookapi_php5_restlib.php';
This will include the REST library.
This is pretty much the initial setup. You can use the same “Facebook” library to for “Facebook Connect” functionality.