CodeIgniter Forums
change config items - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: change config items (/showthread.php?tid=50272)



change config items - El Forum - 03-20-2012

[eluser]works4u[/eluser]
I need to change config items either on the config.php page or within the controller itself.

I have tried to get sees_expiration on a controller and changed from the config file from a db table called settings.


change config items - El Forum - 03-20-2012

[eluser]Aken[/eluser]
Soooo what are you asking exactly?

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



change config items - El Forum - 03-20-2012

[eluser]works4u[/eluser]
$this->config->set_item('sess_expiration', '60');

Does not work for me if loaded into a controller. Any idea's?


change config items - El Forum - 03-20-2012

[eluser]CroNiX[/eluser]
You can't change the session config that way. It doesn't store it permanently in the config file. The very next request to the server will read the config file and set it back.


change config items - El Forum - 03-20-2012

[eluser]works4u[/eluser]
I want a way to do it site wide but store config settings in a db?


change config items - El Forum - 03-20-2012

[eluser]CroNiX[/eluser]
You'd have to create that functionality.


change config items - El Forum - 03-20-2012

[eluser]works4u[/eluser]
So I have session expiration in a db and want the user of a cms to control this. How would you go about this?



change config items - El Forum - 03-20-2012

[eluser]CroNiX[/eluser]
Not positive off the top of my head. But you probably shouldn't have session in autoload. You'd have to create a library, which would be autoloaded, that will read/write config data to the database. Then, in the construct of this library, have it read the config values from the database for the session and then initialize the session library. You might possibly have to extend the session library as well. Not sure. Never tried this. Why do you need to dynamically change the session time? Seems that should be constant.


change config items - El Forum - 03-20-2012

[eluser]works4u[/eluser]
Client wants to be able to change this.

Will post what I did.

Thank you