User Profile
- User
- iamcam
- Location
- San Diego
- URL
- http://www.mistercameron.com/
Recent Articles
Simply storing config values in the DB
There are many situations in web apps where site-wide configurations need to be accessible to users through admin interfaces, rather than configuration files residing on the server. It is a practical method of storing configuration values that may need changing from time to time, but without access to the core configuration file.
- Published by iamcam 10/26/08 - 18:48
- 10928 views
- 5 comments







I like this. Definitely something I will probably use in the future.
@Gediminas
There's probably a decent benchmark on the web somewhere. I think the general argument of writing rules into the vhost file is that you get a performance boost b/c the rules are loaded into memory when Apache starts up. .htaccess files are read and parsed each time the site/directory is accessed. I'm not an Apache guru, so I could be wrong.
@Jonah Turnquist: You're right - a flat file would just as well. Cake has a method to define a flat file used to store your configuration files. Either way should work fine.
@Christian Deluxe: That's definitely in the direction of another idea/method I had for storing values.
Perhaps one benefit to storing any config values in a database is that you can apply scope to the data being selected. Consider the situation in which you have several sites (subdomains?) running off of one set of Cake files and one database. Applying the scope of "mysite" to your select statement can be an easy way to segregate settings used on different web sites.
Andrea,
That is addressed in the TinyMCE documentation. I haven't used that feature for any production work yet, but from what I remember it should be fairly straightforward. I think you tell TinyMCE to apply itself to all textareas with a specific class.