Write to custom config? |
[eluser]spmckee[/eluser]
I have created a custom config file and am using CI's config class but how can I write to the new config? Basically I have a form in the admin panel that is reading the config, I need to be able to change those settings and save them. Any good tutorials or solutions others have come up with? Thanks!
[eluser]BrianDHall[/eluser]
You might find it easier to store such config in a database, as altering the values of a config files is...well, 'non-trivial' (read: a pain in the ass, at best). Meanwhile changing db settings are super-easy and relatively pain-free.
[eluser]spmckee[/eluser]
It's interesting you say that and I originally thought the same. I've used different CMSs in the past and I've seen them use a mix of DB and .php configs. I guess I started going down this path because CI has the config class which takes care of half the battle. If it's a real pain to write to then it looks like DB may be the way to go.
[eluser]spmckee[/eluser]
Think I'm gonna stay with the text config. It's a beautiful thing when I can load the config in My_Controller and access it globally without having to mess with a query. And wouldn't you know it, 30 minutes later I come across the answer somwherez. ![]() For those interested: Code: <?php
[eluser]Mr. Ed[/eluser]
I'll give it a try, buy but you are missing the allready written data in the config file. I'll fight with that. Thanks!
[eluser]pistolPete[/eluser]
Have also a look at http://ellislab.com/forums/viewthread/131748/. |
Welcome Guest, Not a member yet? Register Sign In |