I have created a custom configuration file for my custom CMS I am building using CodeIgniter. I want to have a "Configuration" page in the CMS that allows the user to save a contact email address and other variables.
I want to allow the user to set these config variables on the fly from the admin CP but I am having trouble doing so.
I found this article here: Dynamically updating config data codeigniter which asks a similar question but the answer is not exactly what I was looking for.
Is it possible to update a config file permanently on the fly from a controller? Right now my code looks like this:
$this->config->load('cms_config');
//load the initial view
$this->data['subview'] = 'admin/setup/index';
$this->load->view('admin/_layout_main', $this->data);
//validate form
if($this->form_validation->run('site_config') == TRUE) {
$this->config->set_item('contact_email', $this->input->post('contact_email'));
}
but this doesn't seem to update the file at all. In fact, nothing seems to happen upon form submit.