Willy
Willy

Reputation: 9881

Facebook PHP API with Zend Framework

I am using Zend_Framework's Zend_Controller_Action to build a facebook application. I followed the step by step of this blog for guide : http://blog.madarco.net/91/build-a-facebook-application-with-zend-framework/

public function indexAction() {
   require_once('facebook.php');
   $fb = new Facebook('1234567', '7654321');
   $user_id = $this->fb->require_login();
}

But the result is that the page went blank. Nothing happened.

As I use Smarty for the 'viewing' part, later I tried this following code :

{php}
require_once('facebook.php');
$facebook = new Facebook('1234567','7654321');
$user_id = $facebook->require_login();
{/php}

And it works.

I wonder what is wrong when I use Zend Framework to access Facebook API. Please help me on this one.

Thanks

Upvotes: 1

Views: 6328

Answers (1)

Matt
Matt

Reputation: 75317

Try

public function indexAction() { 
   require_once('facebook.php'); 
   $fb = new Facebook('1234567', '7654321'); 
   $user_id = $fb->require_login(); 
} 

(or on the other side of things...)

public function indexAction() { 
   require_once('facebook.php'); 
   $this->fb = new Facebook('1234567', '7654321'); 
   $user_id = $this->fb->require_login(); 
} 

Upvotes: 1

Related Questions