[eluser]CrazeD[/eluser]
Hi, new here...
Okay so, I'm trying to use IPBSDK with Codeigniter. If you aren't familiar with IPBSDK, it is a very useful class for integrating Invision Power Boards into your main website. It includes login/logout functions, getting info... tons of useful stuff.
Now, I've made it work, but in a troublesome way. I have a header and footer PHP files for my template, then I just slip in the current page in the middle. My controller for any given page looks like so:
Code:
class Test extends Controller {
function index() {
$this->load->view('header');
$this->load->view('test');
$this->load->view('footer');
}
}
Now, I couldn't get the SDK to load with the $this->load->library function, so I just included the class on the main index.php file, which works fine.
So, my header and footer files both have to call the IPBSDK class, like so:
I have that at the beginning of both files. Most of my pages also require this, so I have to have it at the beginning of those pages as well.
Most of the SDK functions work great, except login/logout functions. It is because I called the IPBSDK class in the header, footer, and current page files. If I do this it works:
Code:
class Test extends Controller {
function index() {
$SDK = new IPBSDK;
$data['SDK'] = $SDK;
$this->load->view('header',$data);
$this->load->view('test',$data);
$this->load->view('footer',$data);
}
}
Now, everything works.
However I don't want to have to do that for every controller, is there anyway I can call this class from one location and have it available on all pages?
Thanks.