Reputation: 6284
In my code, According to the user guide, I write this code (In a controller)
$this->config->load('countries_config.php');
But unfortunately, get this PHP error:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Countries::$config
Filename: controllers/Countries.php
Line Number: 12
Any idea why I can't use the config?
Countries
extends CI_Controller
Upvotes: 0
Views: 486
Reputation: 6284
OK, the problem occured because I was trying to load the config file before doing parent::_construct();
Fixed by doing it after
Upvotes: 0
Reputation: 116
what is counteries_config.php is this controller,model or view file $this->config->load('filename');
Upvotes: 0
Reputation: 1167
To load one of your custom config files you will use the following function within the controller that needs it:
$this->config->load('filename');
Where filename is the name of your config file, without the .php file extension.
without .php extensions
try this
$this->config->load('countries_config');
Upvotes: 1