Welcome Guest, Not a member yet? Register   Sign In
config library
#1

[eluser]ram4nd[/eluser]
how can i change config file variables?

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

this line doesn't seem to work for me
#2

[eluser]Milos Dakic[/eluser]
ram4nd and welcome to the CodeIgniter forums.

Please have a better read of the CodeIgniter User Guide. You have not specified much detail in your question, such as where the code is being used, in conjunction to what is the code being used for. From what you have posted that line of code should work fine in a proper setup.
#3

[eluser]khagendra[/eluser]
This is mainly used to set the some variables of config array.
Open the config/config.php

You will find this line(for base url)
Code:
$config['base_url'] = "http://example.com/";

suppose u want to set the base url with different value(newexample.com), then do like this

Code:
$this->config->set_item('base_url', 'http://newexample.com/');

Here, base_url is item_name and http://newexample.com/ is item_value

Similarly, u the language can be set. By default it is
Code:
$config['language'] = "english";

To change it to "nepalese"

Code:
$this->config->set_item('language', 'nepalese');

To change it to "french";
Code:
$this->config->set_item('language', 'french');

Now, it will help to understand
#4

[eluser]ram4nd[/eluser]
yes thank you I all ready dug op the code, i though that you can actually change conf file variables with that function so you could build admin panel.




Theme © iAndrew 2016 - Forum software by © MyBB