[eluser]Ty Bex[/eluser]
I would like to make a library available to all contollers.
My Library is in the application/libraries/Auth_user.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Auth_user{
function Auth_user()
{
$CI =& get_instance();
$CI->load->database();
$CI->load->library('session');
$CI->load->library('encrypt');
$CI->load->library('validation');
$CI->load->helper('form');
}
function check($check_level)
{
/*DO SOME CHEKCING*/
}
}
Currently my controller is /application/controllers/backend/welcome.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends Controller {
function Welcome()
{
parent::Controller();
$this->load->library('auth_user');
$this->auth_user->check('admin');
}
function index()
{
echo "<br />BACKEND WELCOME.PHP<br />SUCCESS TO INDEX FUNCTION<br /><br />";
}
}
What I want to do is just call the library and not have to load the library for every page. (Commented out line)
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends Controller {
function Welcome()
{
parent::Controller();
/*$this->load->library('auth_user');*/
$this->auth_user->check('admin');
}
function index()
{
echo "<br />BACKEND WELCOME.PHP<br />SUCCESS TO INDEX FUNCTION<br /><br />";
}
}
I am not 100% where to go with this one...Thanks in advance