[eluser]stevefink[/eluser]
Hi all,
Just trying to understand the internals of CI a bit better here.
I created a custom authorization class for usage with CI which I placed in system/application/libraries folder. For the purpose of this example, let's say my class is named Auth.
Here's an example of what I put in the libraries directory, file named Auth.php
Code:
class Auth {
var $CI;
function Auth()
{
$this->CI =& get_instance()
}
function foo()
{
echo "Testing custom lib!";
}
}
My controller looks like the following:
Code:
function index()
{
$this->load->library('auth');
}
function bar()
{
$this->auth->foo();
}
Is there any reason why that won't work? I had to move the library loading into the bar() function and call Auth::foo() to see my method get invoked. I'm curious what is possibly done not in the conventional way that is breaking the code above (although no errors are being spat out.)
Thanks all.
/sf