Welcome Guest, Not a member yet? Register   Sign In
Load config from database
#1

[eluser]Philo01[/eluser]
Hi there,

I'm wondering what's the best way to tackle this.
My application is going to be installed by a step by step wizard.

In this wizard you will be asked to enter database information, base url etc.
This data will be stored in the database, so the user can updated it at anytime using the back-end control panel.

So how would I load this from my database and assign it to the variables.
For example:

Code:
$config['base_url']    = "http://www.yourdomain.com/";

How would I replace this with the data from the database?
Because I don't think it is possible or clean to add database queries in the config file. (Or am I wrong).

Anyways, besides loading those basic config settings from the database, I want to other things aswell, for example.

Code:
function upload(){
    $config['quality'] = // Load setting from database...
    $this->load->library('image_lib', $config);
    $this->image_lib->resize();
}

Could someone push me in the right direction Smile ?

Thanks!

Kind regards,

Philo
#2

[eluser]InsiteFX[/eluser]
Hi,

Code:
$this->config->set_item('item_name', 'item_value');

See the CodeIgniter user_guide:

user guide config

Enjoy
InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB