[eluser]dfau[/eluser]
Hi wiredesignz,
I'm still having trouble getting system libraries to work properly from view. The validation library is good to use from the view as it saves a lot of work in the controller for setting up error responses.
I've not been using CI for long and am learning as I go. In your library loading function you load the system libraries around line 238:
Code:
if (is_file(BASEPATH.'libraries/'.$library.EXT) OR is_file(APPPATH.'libraries/'.$library.EXT))
{
parent::library($_library);
$my = $this->_me->config->item('subclass_prefix');
$library = (class_exists($my.$library)) ? $my.$library : 'CI_'.$library;
$this->_update_ci_classes();
}
and then call the constructor for the same library and assign to _me around line 345:
Code:
$this->_me->$_library =& new $library($params);
This causes (in my example) the validation library to be loaded twice, and bound in two different spots; one in $this->_me and the other in global $ci. These aren't referenced, but are two separate instances. When I manipulate $this->validation in my module, I'm not manipulating $ci->validation, which is the one used in the view.
As a hack, if I replace the second constructor call with:
Code:
$ci =& get_instance();
$this->_me->$_library =& $ci->$_library;
$this->validation and $ci->validation are now pointing to the same thing. I think.
Could you please have a double check to see exactly what the behaviour should be? I'm happy to do any testing required.
Many thanks,
dfau