Facebook app with Kohana 3
Using FB in a site is simple
require_once 'facebook-php-sdk/src/facebook开发者_开发百科.php';
// Create our Application instance.
$facebook = new Facebook(array(
'appId' => 'zzzz',
'secret' => 'zzz',
'cookie' => true,
));
I have tried the following in the bootstrap.php
include Kohana::find_file('vendors/Facebook', 'facebook');
//gives correct path, facebook.php is 755
The Facebook class is written as:
class Controller_Facebook extends Controller{}
$this->facebook = new Facebook(array('appId' => 'zzz', 'secret' => 'zzz', 'cookie' => true,));
//the line above causes the error below
ErrorException [ Fatal Error ]: Class 'Facebook' not found
Has anyone solved this problem before? If so, then how do I access $this->facebook in the controllers
I think you have a typo in the path, you want:
include Kohana::find_file('vendor/Facebook', 'facebook');
'vendor/' instead of 'vendors/' in the path.
Take a look on a zombor's Facebook module. You can extend it for your needs (seems like it has only authorization features).
精彩评论