I am using canvas for application development and the CodeIgniter framework.
I have a link in a view, <a href='http://example.com/index.php/module/controller/action'>click here</a> and I have a controller as:
public function index() {
$user_profile = $this->facebook->api('/sujeet216');
$token = $this->session->userdata('token');
$response = $this->fb_model->checkUser($token);
if ($response->num_rows <= 0) {
if($this->fb_model->insertUser($user_profile,$token)) {
$this->load->view('intro',$user_profile);
}
}
else {
$this->load->view('index',$user_profile);
}
}
public function intro2() {
$this->load->view('intro2');
}
Whenever I click a link, it redirects to the index controller. How do I load intro2 page from the second function?
It’s possible that the app is trying to authenticate and Facebook redirects the app back to the callback URL that you have set. You have two options to combat this:
I’d recommend going for option number 1 as it gives you much more flexability in relation to using the API once the user has authenticated against Facebook.