Hey all,
I'm having a bit of a tough time getting my iframe-zend-based facebook app up and running. I managed to get it running on my dev box using a fake domain, however it's been redirecting itself all over the place with an auth_token=XXXX when I'm working on my staging site. I've read a lot of people's posts who have issues, but no clear step-by-step guide.
Has anyone done this?
here's my FacebookController's init() function (you can poo-poo my putting stuff straight in the view once I get the damn thing up and running):
public function init()
{
$this->config = Zend_Registry::get('config');
$this->view->layout()->setLayout("facebooklayout");
$this->view->fbcallbackurl = $this->config['fb']['callbackurl'];
$this->view->fbcanvasurl = $this->config['fb']['canvasurl'];
$this->view->appid = $this->config['fb']['appid'];
$this->view->apikey = $this->config['fb']['apikey'];
$this->view->action = $this->_getParam('action');
$this->view->facebookApi = Collaborator_FacebookConnectionManager::getInstance()->getFacebookApi();
$this->view->userid = $this->view->facebookApi->require_login();
}
and my singleton for the connectionManager:
<?php
/**
* Singleton for handling the connection to Facebook
*
* @author jon
*/
class Collaborator_FacebookConnectionManager
{
/**
*
* @var Facebook_Facebook
*/
protected $facebookApi;
/**
*
* @var Collaborator_FacebookConnectionManager
*/
protected static $connectionManager = null;
protected function __construct()
{
$config = Zend_Registry::get('config');
$this->facebookApi = new Facebook_Facebook($config['fb']['apikey'], $config['fb']['apisecret']);
}
/**
* Singleton here to ensure one connection
* @return Collaborator_FacebookConnectionManager
*/
public static function getInstance()
{
if (self::$connectionManager === null)
self::$connectionManager = new self();
return self::$connectionManager;
}
/**
*
* @return Facebook_Facebook
*/
public function getFacebookApi()
{
return $this->facebookApi;
}
}