Welcome Guest, Not a member yet? Register   Sign In
Running Facebook as library, not plugin
#1

[eluser]gh0st[/eluser]
I'm trying to get a very basic facebook app up and running using CodeIgniter, and all the tutorials describe using the client library provided by Facebook as a plugin.

I want to use it as a library, as it makes more sense to use it as a library.

I have tried using the Facebook connect library that Elliot created, but I am unable to do the create an app that would produce a list of friends or something equally basic.

Is there anyone who has built facebook apps before using CI? There are no wikis, and very little documentation on how to do it.

Any help would be great
#2

[eluser]Jerry Wu[/eluser]
1. Download the facebook client lib, and put the "facebook-platform" dir into /system/libraries/

here is the files in the path /system/libraries/facebook-platform/
facebook.php
facebook_mobile.php
facebook_desktop.php
facebookapi_php5_restlib.php

and sub-dir "jsonwrapper"

2. and then create /system/libraries/Facebook_client.php, this class load facebook client lib

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Facebook_client {

    function __construct() {
        require_once(BASEPATH . 'libraries/facebook-platform/' . 'facebook' . EXT);
    }
}

?>

3. load the facebook_client library in your controller
Code:
class Demo extends Controller {
       var $facebook;
          
           function index(){
      
              $this->load->library('facebook_client');
              $this->facebook = new Facebook('xxx', 'xxx');
              $this->facebook->require_frame();
              $viewer_id = $this->facebook->require_login();
    
              echo $viewer_id; //when you see your facebook uid, it works
       }
}
#3

[eluser]gh0st[/eluser]
Hi there.

I will try this out today and post back on what I have found.
#4

[eluser]gh0st[/eluser]
Hey that worked perfectly! I got it to output a list of friends (the example/sample script from Facebook).

Thanks for your help, I am much happier now.

Now all I have to do is figure out how users move from page to page on a Facebook app, is it like:

app.facebook.com/YOUR_APP/index.php/demo/somefunction/

Or is it another system?

Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB