Welcome Guest, Not a member yet? Register   Sign In
Merging Facebook SDK with CodeIgniter 2.0
#1

[eluser]deth4uall[/eluser]
I have made a blog at BlogSpot - PHPSorceror that I would like to get reviews for, anyone can view and comment on it. I will update with relevant information I get from it. Essentially I am looking for a peer review.
#2

[eluser]davidbehler[/eluser]
Quote:Unfortunately unlike a lot of other tutorials say you can just create a config file for facebook, well that was for the modified and butchered versions of the facebook api.
I got no idea what you are talking about...what butchered version!? But I don't see a reason why you can't just use a config file instead of passing the config values manually each time you load the lib!?

Just create a facebook.php in /config and add this as its content:
Code:
<?php
$config['appId'] = 'your_app_id';
$config['secret'] = 'your_app_secret';
$config['cookie'] = true;
?>
Now whenever you want to use the facebook lib, all you have to do is call
Code:
$this->load->library('facebook');
and CI will automatically take the values from the config file and pass them as the first parameter to the constructor of the library...pretty much the same thing you did manually.

This way you can use the lib where ever you want and don't have to worry about copying the credentials each time.

P.S.: I've never worked with the FB API/this lib before, it's just some comment based on my experience with CI.
#3

[eluser]deth4uall[/eluser]
I have seen alot of CI integrations on the net that cut down the php sdk for facebook and add extra functions, etc. So those are the ones I talk about. Elliot Haughin's Code Igniter Library for example is one that has not been updated in quite a while, as well as adds several functions that are not originally found in php-sdk. I know it worked a while back, but I found that using the original copy and loading as a library works best.

Ah okay, thanks! That will help me quite a bit in regards to using the facebook api as a library. I can always learn, and as such I will use this in my code.

The facebook api is a bit of a pain to use, but once you know how to load it without altering the original context it works like a charm in CI.




Theme © iAndrew 2016 - Forum software by © MyBB