[eluser]Ricardo SDL[/eluser]
I'm lost here. I created a library (one simple class) and used it in the controller with no problems. Then I tried to load it in the view just to call one method of the class. The constructuor of the class get called but the reference of the class stays as null.
Some code:
This works (controller):
Code:
$this->load->library('search_vehicle_params_manager');
$this->search_vehicle_params_manager->search_vehicle_params = $search_params;
$this->search_vehicle_params_manager->save_params();
return $this->search_vehicle_params_manager;
This doesn't work (view):
Code:
$this->load->library('search_vehicle_params_manager');
$params_manager = $this->search_vehicle_params_manager;
$search_vehicle_type = $params_manager->get_param_value(Search_vehicle_params_manager::VEHICLE_TYPE);
I get this error message:
Quote:A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Loader::$search_vehicle_params_manager
Filename: views/header.php
Line Number: 64
I'm using CI 1.7.2 and this is the php version information:
PHP 5.2.6-2ubuntu4.3 with Suhosin-Patch 0.9.6.2 (cli) (built: Aug 21 2009 20:36:27)
Copyright © 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright © 1998-2008 Zend Technologies
The only piece of code executed inside the library constructor is this onde:
Code:
$this->ci = & get_instance();
I've checked that in the view this code is executed. Probably is a dumb mistake, any ideas?
Thanks!