Ninjakreborn Posted May 20, 2010 Share Posted May 20, 2010 I have a display class I have started using in Codeignitor to do all of my display stuff. I just threw it in Libraries and started using it as one of the built in Codeignitor libraries (by following their naming conventions. For the first time I have tried to use another library inside my display class and it throws an error that it's not a class. I am simply trying to call the $this->session->flashdata() inside the display class. Is there another way to do this, or am I doing it wrong? Quote Link to comment https://forums.phpfreaks.com/topic/202448-library-in-another-library/ Share on other sites More sharing options...
trq Posted May 20, 2010 Share Posted May 20, 2010 Have you defined $this->session anywhere? Quote Link to comment https://forums.phpfreaks.com/topic/202448-library-in-another-library/#findComment-1061429 Share on other sites More sharing options...
purpleshadez Posted June 3, 2010 Share Posted June 3, 2010 As thorpe has said, it needs to be defined. As far as I'm aware, there are 2 options in code igniter. 1.) If you need to use the session library throughout your application then check to ensure that it is autoloaded in application/config/autoload.php. It should be on line 42. // Option 1 $autoload['libraries'] = array('session', 'database'); 2.) If you only need it for say, a backend then place the line below in the constructor of your backend controller. // Option 2 $this->load->library('session'); Bootnote: I have just noted that you are using your own library. this page advises that you will need to use get_instance() to use the native CI resources. $CI =& get_instance(); $CI->load->library('session'); Quote Link to comment https://forums.phpfreaks.com/topic/202448-library-in-another-library/#findComment-1067041 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.