[eluser]Aea[/eluser]
I have a library that I want to access session data without explicitly passing it in, I'm using a custom session class (although this shouldn't really play in much), I'm having the following issue..
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Pages::$session
Filename: libraries/Themer.php
Line Number: 21
Pages is the controller I'm running this from.
My Hooks File (I explicitly run sess_run), session doesn't auto-load and this part "works"
Code:
$hook['post_controller_constructor'][] = array(
'class' => 'Session',
'function' => 'sess_run',
'filename' => 'Session.php',
'filepath' => 'libraries'
);
Library Code
Code:
12 class Session {
13
14 /*
15 |--------------------------------------------------------------------------
16 | Constructor
17 |--------------------------------------------------------------------------
18 */
19 function __construct()
20 {
21 $this->CI =& get_instance();
22 log_message('debug', 'AE_MemSession Class Initialized');
23
23 $this->CI->load->model('aes', 'aes');
24
25 if($this->CI->config->item('sess_match_useragent'))
26 {
27 //
29 }
30 else
31 {
32 //
33 }
34 }
35
36 public function test()
37 {
38 echo 'WEE';
39 }
Other Library Trying to Access Property...
Code:
19 public function generate_header()
20 {
21 $this->CI->session->test(); // PROBLEM HERE
22 }
What am I missing? And, what would be the most efficient OO-Correct way to do this (previously I was using $_SESSION which had the benefit of being available everywhere.)