Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error #1

Closed
nabeelio opened this issue Jul 8, 2010 · 15 comments
Closed

Error #1

nabeelio opened this issue Jul 8, 2010 · 15 comments

Comments

@nabeelio
Copy link

nabeelio commented Jul 8, 2010

So I've extracted the folder in the zip, I am getting:

Undefined variable: facebook [APP/views/layouts/default.ctp, line 1]
Fatal error: Call to a member function html() on a non-object in /var/projects/dormillo/app/views/layouts/default.ctp on line 1 

Not quite sure what I'm doing wrong? I've followed the instructions in the readme including the config file...

In my AppController,

public $components = array('Session', 'RequestHandler', 'Auth', 'Facebook', 'Facebook.Connect', 'Facebook.FacebookApi');

And yep, it's cake 1.3

@webtechnick
Copy link
Owner

Make sure the folder name in your plugin directory is called "facebook". Should be in app/plugins/facebook

Also, please note you do not need 'Facebook' as a component/helper in your list, unless you have a facebook component in your controllers/components directory.

Hope that helps,
Nick

@nabeelio
Copy link
Author

nabeelio commented Jul 8, 2010

Thanks for the reply. It is apps/plugins/facebook:

> /app/plugins/facebook $ ls
README.txt  config  controllers  facebook_app_controller.php  facebook_app_model.php  libs  tests  vendors  views  webroot

It's not liking it in the display.ctp.

@webtechnick
Copy link
Owner

Ah, you're not loading the ehlper then. The $facebook->html() is a helper.

In your controller you need to add:

var $Helpers = array('Facebook.Facebook');

Hope that helps,
Nick

@webtechnick
Copy link
Owner

var $helpers = array('Facebook.Facebook');

@nabeelio
Copy link
Author

nabeelio commented Jul 8, 2010

Yep, it's in there, in my app_controller.php.

public $uses = array();
public $components = array('Session', 'RequestHandler', 'Auth', 'Facebook.Connect', 'Facebook.FacebookApi');
public $helpers = array('Facebook.Facebook');

I think that's correct? I've been having so much trouble with CakePHP, for some reason. This is my 5th or 6th Cake project, but this time around I'm having problems with every aspect... forms.. auth.. yeck.

I wonder if it's being overwritten or something... edit nope, put it in my current controller, still nothing

@webtechnick
Copy link
Owner

OK, then make sure you're not hitting a variable collision. Make sure you don't have any $facebook variables set anywhere in your actions, or if you're running CakePHP 1.3 use $this->Facebook->html()

@webtechnick
Copy link
Owner

BTW. you don't need uses = array() in your app_controller. that will cause problems of auto loading models down the inheritance chain.

just FYI

@nabeelio
Copy link
Author

nabeelio commented Jul 8, 2010

I tried $this->Facebook->html(), still no go.
Yeah, the empty $uses was from when I was autoloading one model for beforeFilter().

It gives me this now:

Undefined property: View::$Facebook [APP/views/layouts/default.ctp, line 1]

When I take out:

'Facebook.Connect', 'Facebook.FacebookApi'

From $components in AppController, no more errors, but my entire layout is gone. Not sure what's going on.

@nabeelio
Copy link
Author

nabeelio commented Jul 9, 2010

Alright, the layout is gone because now it's not loading the Session component. Cake is horribly frustrating at times. Thanks for the help

@nabeelio
Copy link
Author

nabeelio commented Jul 9, 2010

Okay, this seems to be good now. Thanks!

@Creator2010
Copy link

@nshahzah.am new to cakephp but not programming.am expecting an error close to yours.
Notice (8): Undefined property: View::$Facebook [APP\views\pages\display.ctp, line 3]. what is the lightly solution

@nabeelio
Copy link
Author

Sorry, I don't remember. I stopped using this plugin and implemented the library that was directly from Facebook, that fixed many of my issues.

But that's just a notice, so it can be safely ignored, unless you're not seeing what you were expecting to see?

@Creator2010
Copy link

ok.What library are you using?i could change mine right away,since you already have something working for you.

@Creator2010
Copy link

thanks.I have fixed the problem.i placed the var $helpers = array('Facebook.Facebook'); in the app_controller.php in the controller folder.I initially placed it in the app_controller.php in the app folder

@xchitox
Copy link

xchitox commented Jan 3, 2013

Hi Nick,

I am using the latest version of cakephp with your latest facebook plugin. I have got the same error to that nshahzad had mentioned. I have checked everything your mentioned on your blog and all the comments of this post.... I am pretty sure the plugin is installed correctly, and here's my controller

class FbusersController extends AppController{
public $helpers = array('Facebook.Facebook');

    public function index(){

    }
}

I can't figure out why the facebook helper can't be loaded

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants