Welcome Guest, Not a member yet? Register   Sign In
Unable to write to config file
#1

[eluser]Dsyfa[/eluser]
Hi,

I have some fields in my config that I would like to modify dynamically.
Code:
/*
|--------------------------------------------------------------------------
| Global Meta Data
|--------------------------------------------------------------------------
*/
$config['md_keywords'] = 'lorem, ipsum';
$config['md_description'] = 'Lorem - Ipsum.';

This is the code that I'm using to modify the above fields.
Code:
$data[ 'keywords' ] = $this->input->post( 'keywords', true );
$this->config->set_item( 'md_keywords', $data[ 'keywords' ] );

Where am I going wrong?

Thanks
#2

[eluser]xwero[/eluser]
The set_item method doesn't write to the config file itself. It only overwrites the fetched value that has been set in the file.

If you want some input to be remembered you better put it in the session data. If you want some preferences remembered longer you add it to the database and overwrite default config values from the database.

You have to look at the config file variables as constants. They should only be changed when it affects the whole application.
#3

[eluser]Dsyfa[/eluser]
[quote author="xwero" date="1199893606"]The set_item method doesn't write to the config file itself. It only overwrites the fetched value that has been set in the file.

If you want some input to be remembered you better put it in the session data. If you want some preferences remembered longer you add it to the database and overwrite default config values from the database.

You have to look at the config file variables as constants. They should only be changed when it affects the whole application.[/quote]

Thanks! Learned sumthing new 2day!




Theme © iAndrew 2016 - Forum software by © MyBB