the_unforgiven_II
the_unforgiven_II

Reputation: 361

Codeigniter Config file, load a get function from model

I have a custom config file setup for twitter, which has some vars in but the data is saved in the database, so therefore i need to call something like:

$this->wc_settings->get()->row_array('consumer_key')

Here's the config file

$config['tweets'] = array(
'_tokens' => array(
    'consumer_key' => $this->wc_settings->get()->row_array('consumer_key'),
    //'consumer_secret' => '',
    //'access_key' => '',
    //'access_secret' => '',
),

This doesn't work but I need it to in order for the config file to work, but need to get the data from the database like shown above. Help greatly appreciated.

Upvotes: 2

Views: 1958

Answers (1)

Girish
Girish

Reputation: 893

You can dynamically set the config in your controller or model using:

$this->config->load('tweets');
$dynamic_config = $this->wc_settings->get()->row_array('consumer_key');
$this->config->set_item('_tokens['consumer_key']', $dynamic_config);

Upvotes: 5

Related Questions