• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Autoloading a configuration file ?

I wanted to use the auto load() function to load a configuration script. I defined it in the configuration file to auto load and then i discovered the problem !! i need my own written configuration script at the beginning of the loading sequence. My configuration file has a lot of configuration settings that are needed for some of my own developed library classes.

Because the configuration file is not loaded before the core classes are initialized, i cannot use the settings inside it !!


Configuration files are almost always needed immediately right after system gets loading. Is there a way to auto load a configuration file that gets initialized immediately ?

If not, how can i use my own configuration file t load just after the start without hacking into the code ?

Welcome to the CodeIgniter community!

Configuration files are loaded before any libraries are, so you shouldn't have any problems. If you can be more specific about what your configuration script does, we may be able to help more.

[eluser]Amitabh Roy[/eluser]
As mentioned by @carlosrowlett , if you are setting the configuration values in your custom config file like for e.g.
$config['site_template_themes'] = 'http://localhost/mywebsite/assets/themes/';
you should not have any problem. Else a look at what your config file does is needed.

To auto load your custom config file set

$autoload['config'] = array('MY_CONFIG_FILE');

in the applications/config/autoload.php

But it also seems from your post that your issue may need to be dealt with hooks at pre_system and pre_controller hook points Codeigniter hooks

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.