Welcome Guest, Not a member yet? Register   Sign In
Extends CI_Session
#1

(This post was last modified: 09-07-2015, 04:10 AM by djha.)

Hi,

I tried to extends CI_Session by create the file "application/libraries/MY_Session.php".
This file contains the class : 


Code:
Class MY_Session extends CI_Session


But that's not work.

In fact, core session library is in folder "system/librairies/Session/Session.php".
You can see the subfolder different than others libraries (ie Email, Calendar ...)

The problem is the loader use a "trick" by search in subfolder named like class to load when she's not found.
(see system/core/Loader.php at line 1045 One last attempt. Maybe the library is in a subdirectory, but it wasn't specified?)

This new subdir is pass on another method and CI try to load "application/librairies/session/MY_Session.php" and not "application/librairies/MY_Session.php".


M.

Note: I tried to search in forum a thread about that, but no thread found, for this reason I created it.
Reply
#2

MY_Session should go into application/core, not in application/libraries.
See http://www.codeigniter.com/user_guide/ge...asses.html
Reply
#3

Hi,

You are wrong, CI_Session is not a core class like "Controller" or "Exception".
You can find "CI_Session" in "system/libraries" and not in "system/core".

If you want to extends "CI_Session" library, you have to put your "MY_Session" in "application/libraries/Session/MY_Session.php".

Unlike "Emails", "Calendar" and others libraries that you put your files in "application/libraries", CI_Session is exception because the loader add automatically subfolder named like the class called.

To resume, you have to put your extended libraries files by using the same path that the core libraries.

M.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB