![]() |
extend core class CI_Session problem - 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: extend core class CI_Session problem (/showthread.php?tid=12529) Pages:
1
2
|
extend core class CI_Session problem - El Forum - 10-22-2008 [eluser]mdr[/eluser] Hi ppl I'm do something wrong and I need help with my problem I created the Session.php in application/libraries with the next code: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); And error is: Fatal error: Class 'Session' not found in /usr/local/www/geowines/system/application/libraries/Session.php on line 2 line 2 is class MY_Session extends CI_Session.... any idea? extend core class CI_Session problem - El Forum - 10-22-2008 [eluser]drewbee[/eluser] When you are loading the library, you are doing this? Code: $this->load->library('session'); and not Code: $this->load->library('my_session'); Correct? extend core class CI_Session problem - El Forum - 10-22-2008 [eluser]mdr[/eluser] yes, but don't work and I solve rename file and class and load with the new name Code: $this->load->library('sitesession'); thanks extend core class CI_Session problem - El Forum - 10-22-2008 [eluser]Pascal Kriete[/eluser] The original problem would be solved by calling the file MY_Session.php instead of Session.php. extend core class CI_Session problem - El Forum - 10-22-2008 [eluser]mdr[/eluser] Yes, I was confused, but its works thanks for yours comments extend core class CI_Session problem - El Forum - 11-11-2008 [eluser]Vang[/eluser] the manual says that it should work in the first place: Code: $this->load->library('email'); extend core class CI_Session problem - El Forum - 11-11-2008 [eluser]narkaT[/eluser] [quote author="Vang" date="1226423362"]An error in the manual i suppose ?[/quote] nope, inparo already posted why the code written in the manual didn't work. the filename was missing the right prefix ![]() extend core class CI_Session problem - El Forum - 12-22-2008 [eluser]nikefido[/eluser] I know this is old, but I just extended the core Session class (CI_Session to MY_Session) and when I loaded it, I used: Code: $this->load->library('session'); and it loaded the extended class, not the original one. I did NOT have to do: Code: $this->load->library('my_session'); CI ver 1.7.0 extend core class CI_Session problem - El Forum - 12-27-2010 [eluser]Unknown[/eluser] For those starting with CI 2.0, this file will need to be in /application/core/ not /application/libraries/. extend core class CI_Session problem - El Forum - 02-17-2011 [eluser]Unknown[/eluser] Sorry for the major bump but. Greg said that the MY_class should be in core not libraries. This is incorrect as far as my testing goes. My case: Version: 2.0 Extending CI_Session Location: application/libraries/MY_Session.php Definition: Code: class MY_Session extends CI_Session { Effectively replaces the constructor of CI_Session Locating the same file under application/core fails to do so. PS I am also trying to replace CI_Model but haven't been successful at it. I will make a post about it if search on the forum results in no help. -Edit- only applicable to CI 2.0 CI_Session is located in system/libraries, hence MY_Session makes sense to be in application/libraries. Made MY_Model work by locating the file in application/core. CI_Model resides in system/core so it makes sense to be in application/core. The only other change you need to do is change your models (in application/models) to extend MY_Model not CI_Model. And if your model construct functions still contain the following: Code: parent::CI_Model(); change it to: Code: parent::__construct(); Location: application/core/MY_Model.php Definition: Code: class MY_Model extends CI_Model |