![]() |
Storing site settings
I'm hoping to be able to use the cms I'm making on a few different sites so I decided to make a settings page where I can edit settings when I move it across to a new site. The page has details like the sites url. They can all be changed by editing the value in a form.
Whats the easiest way to store the settings? Just write them to a php file or save them in a database somehow? |
Save them in the database somehow. :)
|
I personally would recommend saving it in a file in a central location, i have it in a folder named /sites/_shared/ however if you make have base directory restrictions in effect (will probably unless you own the server).
However using the database option will mean you have to login to a different mysql database, and if you have another database you need to use, then you will add extra load loginning into two seperate databases. |
If it was just me using the system then I'd simply enter them into one central file. However, as you want it to be really simple to use, then the database option is the way forward. You'll also want a set-up screen for them to enter their database details using an on-line form, as opposed to opening up a PHP file.
|
To further elaborate on some points raised already, there are a few different meanings to "settings" which I feel should be treated in different ways.
There are system settings -- things which affect how and if the system itself will work. This includes things like DB connection details usually. As Wildhoney mentioned, it would be nice to have a HTML form which writes to a (PHP) file storing these important and necessary settings. Without these, the system cannot access the second type: application settings. The application in your case is the CMS which I've no doubt has a whole bunch of settings which you'd like to store such as the working site's name, URL, theme choices, file storage locations, etc. I think this second type of settings is better located inside the database rather than in specific configuration files -- it's all part of the data associated with your web application and should be stored as such. You'll notice (if you decide in the future to dig into them) that many apps follow this type of approach including Wordpress to name one. That said, there are many which choose other ways of doing things so all of this is merely one suggestion of a way to handle it. :) |
| All times are GMT. The time now is 05:46 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0