Welcome Guest, Not a member yet? Register   Sign In
how do you load a library for all pages in a controller?
#1

[eluser]Abel A.[/eluser]
Lets say I want to load a library in all my pages, how would I do that instead of calling it on each function?

Example:
Code:
class login extends CI_Controller {

public function index()
{
  $this->load->helper('url');
}

public function forgot()
{
  $this->load->helper('url');

}

public function activate()
{
  $this->load->helper('url');
}

}
#2

[eluser]Aken[/eluser]
Do it in the constructor - __construct()
#3

[eluser]InsiteFX[/eluser]
As for the url_helper I would autoload it being as it is always being used!

Else do like Aken says.

#4

[eluser]Abel A.[/eluser]
Yeah, thanks guys. I just found the autoload feature in CI Smile




Theme © iAndrew 2016 - Forum software by © MyBB