Is it possible to chance config settings in controller? |
We may have
$config['title'] = 'This title; In application/config/config.php Is it possible to change this from controller? To do a change to config file. Maybe some method? like $this->config->change_item('title') = 'new title'; Idk, something? Any way? I mean change this like we would change this directly in the file.
there is another way i'm use it with many of projects ,
create database with table called "settings" and make this table special for those options like " title\footer\last update\ blablalba.... and create one function return whole this table and do example : echo $title; and put it anywhere you want to
Read the so nicely written and easy to follow documentation. It even has a search option to make locating subjects even easier.
setting-a-config-item
(06-20-2017, 04:28 AM)Martin7483 Wrote: Read the so nicely written and easy to follow documentation. It even has a search option to make locating subjects even easier. It's not what it is about. I have to be permament change in config, not temporary
(06-20-2017, 04:22 AM)hicham Wrote: there is another way i'm use it with many of projects , I would like to not use database, queries, etc... all time to just read settings Config file is great place for this, I would love to do all these things here Especially since this file is autoloaded all time and all config vars are available in all controllers by $this->config->item()
(06-20-2017, 05:29 AM)krystian2160 Wrote:(06-20-2017, 04:28 AM)Martin7483 Wrote: Read the so nicely written and easy to follow documentation. It even has a search option to make locating subjects even easier. That is not what you are asking! If it must change permanently, why not just change it in the config file? To change it in the controller one could assume you want to change it temporarily
In controller I mean not directly by editing config file by yourself.
Idk, maybe file editing from controller, script for changing it. But is there way to do it easier?
(06-20-2017, 06:38 AM)krystian2160 Wrote: In controller I mean not directly by editing config file by yourself. Must the value change because you are reusing the code base for a different project? Or must it change based on the URI? Or for some other reason? Explain the situation please
I want to make settings panel in admin page. To change some settings.
But I don't want to keep it in database, and then in normal website read it from database, do needless queries.... In addition we have all config variables in every controller and it is easy to read by item() method of config library. So the best would be to change these values in config.php But I don't want to do it manually since I want to make page to change settings. So I have to do it in controller, file edition or something. I'm looking for easiest way. It should be possible, I think it is the best way and most efficent
Seems like you are looking for some sort of installer for CI so you can set the config of each project via a UI.
Does that sound correct? |
Welcome Guest, Not a member yet? Register Sign In |