Welcome Guest, Not a member yet? Register   Sign In
Codeigniter how to conditionally load config files?
#1

[eluser]sabya[/eluser]
I am using CodeIgniter to write a application. I need to create something like this: - I will have: -

* my_config.php
* config_production.php
* config_development.php

Now, my_config.php will be autoloaded. From there, if it is production server config_production.php will be loaded. Else config_development.php will be loaded.

how should I do this?

I tried doing like this in my_config.php: -
Code:
<?php
if(gethostbyaddr ("127.0.0.1") == 'hello.sabya'){
    $this->config->load('config_production');
} else {
    $this->config->load('config_development');
}
?>

It is not working because, the "$this->config" is not initialized yet.

How can I achieve this?


Messages In This Thread
Codeigniter how to conditionally load config files? - by El Forum - 06-25-2009, 05:09 AM
Codeigniter how to conditionally load config files? - by El Forum - 06-25-2009, 05:15 AM
Codeigniter how to conditionally load config files? - by El Forum - 06-25-2009, 05:25 AM
Codeigniter how to conditionally load config files? - by El Forum - 06-25-2009, 05:29 AM
Codeigniter how to conditionally load config files? - by El Forum - 06-25-2009, 05:36 AM
Codeigniter how to conditionally load config files? - by El Forum - 06-25-2009, 07:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB