Welcome Guest, Not a member yet? Register   Sign In
CI 2.0 and loading Models problems
#1

[eluser]kerell78us[/eluser]
Hi Everyone, I am test driving CI 2.0 and have integrated modular extension which was modified by Phil Sturgeon as well as his (Phil's) extending on of the Base Controller so that I might have default values for Admin and Public access.

When I run the following code in the MY_Controller I get the error listed after the code;
Code:
$this->load->model(ADMIN_FOLDER . 'settings/configs_model', 'cfgObj');
$settings = $this->cfgObj->get_configs();
    
foreach ($settings as $key => $val) {
   $this->config->set_item($val['cfgkey'], $val['cfgvalue']);
}

ERROR:
-----------------------------------------------------------------------------
A PHP Error was encountered

Severity: Notice
Message: Undefined property: Header::$cfgObj
Filename: core/KG_Controller.php
Line Number: 13
-----------------------------------------------------------------------------
Fatal error: Call to a member function get_configs() on a non-object in C:\wamp\www\ci_v2\app\core\MY_Controller.php on line 13

What really baffles me is, when I echo the values set from the database via,
Code:
echo $this->config->item('config_name');
It returns the value, which tells me that the data is being retrieved from the database inspite of which I still get the error message....

It should be noted that I am running the 'Dashboard' controller and am calling the 'Header' module via the 'Dashboard view';

Can anyone shed some light as to why this might be happening...

Thanks...




Theme © iAndrew 2016 - Forum software by © MyBB