Rabinarayan Panigrahi
Rabinarayan Panigrahi

Reputation: 181

Codeigniter HMVC does not load config file

I am trying to load a file from config/common folder which does not load.

I downloaded codeigniter framework and HMVC framework from here and copied to third_party and core folder as per its description and created a config file under application->config->common->test_config.php like below

application
    config
       common
          test_config.php

i have controller (MY_Controller) under core folder and i want to load this file like $this->load->config(common/test); But it does not load test_config.php. Can someone give some clue to load this file.

Regards

Rabinarayan

Upvotes: 0

Views: 1236

Answers (2)

Renard Masque
Renard Masque

Reputation: 73

I think that with CI-HMVC, the $this->config->load() method is looking for config files only inside folders called "config" in any paths loaded.

so if you really need subfolder, you have to create a 'config' folder within your 'subfolder' ... I'd advise you not to put them in the config folder of the application, but in the third_party folder

(note that this would probably work if you put this in the config folder but it seems a bit redundant to me to have config/subfolder/config/config_file - plus I'm sure this is not very orthodox )

third_party/
     subfolder/
          config/
             custom_config.php

then load the config/subfolder into CI as a path

$this->load->add_package_path(APPPATH.'third_party/subfolder');

and finally load your custom config file :

$this->config->load('custom_config');

Upvotes: 0

Abdulla Nilam
Abdulla Nilam

Reputation: 38584

You're using wrong/missing file. Download Codeigniter HMVC from here and Config file placed here


Structure will be

application
    config
        config.php

Note: Use PHP 5.6 or higher

Upvotes: 1

Related Questions