CodeIgniter Forums
[SOLVED] Load library with an alias in MY_Controller ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: [SOLVED] Load library with an alias in MY_Controller ? (/showthread.php?tid=41996)



[SOLVED] Load library with an alias in MY_Controller ? - El Forum - 05-23-2011

[eluser]DjLeChuck[/eluser]
EDIT :
I'm so stupid...
I have a controller already named Utilisateur, so there is a conflict... --'

Hi,

I have a problem I don't understand.

MY_Controller exteds CI_Controller
Utilisateur is a custom library

If I do :
Code:
<?php
// Load the library
$this->load->library('utilisateur');

// Launch a method
$this->utilisateur->estAutorise();
?>
PHP return Call to a member function estAutorise() on a non-object

Now, if I do :
Code:
<?php
// Load the library
$this->load->library('utilisateur', null, 'user');

// Launch a method
$this->user->estAutorise();
?>
It works...

What's wrong ?