I have a web app using the Facebook api and codeigniter. I currently have about 5 methods in the main controller that use the Facebook library currently all my methods look like
private function getFacebookLogout() { $config = array(); $config['appId'] = '**************'; $config['secret'] = '*****************'; $config['fileUpload'] = false; $facebook = new Facebook($config); $logoutURL = $facebook -> getLogoutUrl(); return $logoutURL; } Is there anyway to make this a little cleaner so that I don't have to write those 5 lines of code over and over again
private function __construct(){ //$config and stuff }so that it executes as soon as your class is created. Create your own library and invoke it. Create a model to handle the FaceBook stuff so that you can easily call it from other controllers.