Welcome Guest, Not a member yet? Register   Sign In
Change $config item.
#11

[eluser]webthink[/eluser]
I does sound as if what you want is better handled through the db. CI config is generally confined to the behaviour of CodeIgniter for good reason. I would resist the urge to fill it with application specific (much less user specific) configuration.
#12

[eluser]Derek Allard[/eluser]
Yeah, and if the administrator is the only person who can change them, then how are they getting set? I guess I just don't understand the full scope of what you're trying to do, but in general, I'd suggest that if you want settings different under certain conditions, that you either store that in the db and harvest, or store it in a session and harvest.
#13

[eluser]Young Caveman[/eluser]
I think that i'll eventually use db to store data. My intention is to build an application that frequently handles values that in a CMS have to be settable/changeable/removable. Smile If my cms is a blog, i think administrator will have to change his own blog title whenever he wants.
#14

[eluser]Kemik[/eluser]
[quote author="Derek Allard" date="1207691959"]Yeah, and if the administrator is the only person who can change them, then how are they getting set? I guess I just don't understand the full scope of what you're trying to do, but in general, I'd suggest that if you want settings different under certain conditions, that you either store that in the db and harvest, or store it in a session and harvest.[/quote]

My understanding is that he wants to have a settings area for his CMS where he can set the site title, description, etc.

It could work with the config file but most CMS' I know of use the database.
#15

[eluser]Young Caveman[/eluser]
Yes, this is probably the method i'll eventually use. I suppose it's finally the best, mine was just curiosity, if there was a way to do in the CI config php file. Smile thanks!
#16

[eluser]Unknown[/eluser]
The scenario is this: I'd like to use the $config class to store a number of application-wide settings. These aren't changed frequently, and they're only changed by an administrator of my application. But I'd like to be able to provide a Web-based installer and admin interface. I'd also like to be able to set, for example, base_url via a Web interface - again, to make for a nicer, easier installation experience.

I think two things need to happen: set_config needs to take a third argument specifying the file that the config item should be set it (e.g., it's not always config.php). Second, a write_config(filename) needs to exist to write out the modified configuration settings to a file (assuming permissions allow it). This will probably require CI to internally track which file it got each config item from, not just munging them all into a single array.

Ideally I'd like to be able to do this with the DB config, too - again, to make for a more professional, simpler setup experience for people who install my app.

Storing all this config in the database is sub-optimal. For one, it's a lot of unnecessary DB hits - the stuff I'm putting into my config file is used constantly throughout the application, and will change rarely. Also, putting these into the DB complicates the coding and distribution of the app vis a vis the setup; with a config file, I can easily distribute default settings. Not so if I'm creating the database on the fly - I'd need to run a bunch of INSERTs in my installer routine, which makes that a lot harder than it needs to be.

[quote author="Derek Allard" date="1207691959"]Yeah, and if the administrator is the only person who can change them, then how are they getting set? I guess I just don't understand the full scope of what you're trying to do, but in general, I'd suggest that if you want settings different under certain conditions, that you either store that in the db and harvest, or store it in a session and harvest.[/quote]




Theme © iAndrew 2016 - Forum software by © MyBB