Welcome Guest, Not a member yet? Register   Sign In
need help about config class
#1

[eluser]xeroblast[/eluser]
how do i change the values in a config file that is stored in
Quote:./system/application/config/

the
Quote:$this->config->set_item('item_name','item_value');
will only overwrite the php values not the file itself in the folder.

is there any functions/methods to write the values in the config file?

thanx in advance...
#2

[eluser]Derek Allard[/eluser]
You need to change the actual values in the file, this means either doing it by hand, or using one of PHP's file (re)writing functions. If you have a value that you need changed from request to request, it may be better to implement is as a session or something, and have it get its default value from config, but let users change it.

Welcome to CodeIgniter xeroblast.
#3

[eluser]Colin Williams[/eluser]
Think of editing the config.php file as the default interface for changing settings for your application. Maybe (probably likely) that doesn't fit well with your vision of the application. You probably want a settings interface that lives in the browser. This is when you should move on to, at the very least, having a sort of generic Variable or Setting model that is super-easy to interface with (from the controllers). The config files will still serve a role for core-level settings, but with a database backend you can more elegantly provide a system for the application users.
#4

[eluser]xeroblast[/eluser]
i was thinking of changing the values via the back-end where all users get the config values change by the back-end user. coz front-end users can never change the values.

i guess i have to use the PHP's file function to change it. and besides, i separate my config file.

thanx for replying!
#5

[eluser]Colin Williams[/eluser]
I would go that route if OBDC drivers didn't exist, xeroblast, but they do. Writing to a PHP file seems more trouble than it's worth when you have a robust database abstraction layer to work with.
#6

[eluser]xeroblast[/eluser]
i got your point. but this config file doesn't involve database. it just a simple name-value relation.




Theme © iAndrew 2016 - Forum software by © MyBB