TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 10-26-2007, 07:40 PM   #1 (permalink)
Jmz
The Acquainted
 
Join Date: Oct 2007
Location: Newcastle, UK
Posts: 113
Thanks: 3
Jmz is on a distinguished road
Default 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?
Send a message via MSN to Jmz
Jmz is offline  
Reply With Quote
Old 10-26-2007, 09:05 PM   #2 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Save them in the database somehow. :)
Salathe is offline  
Reply With Quote
Old 10-26-2007, 09:11 PM   #3 (permalink)
Super Moderator
Advanced Programmer 
 
bluesaga's Avatar
 
Join Date: Sep 2007
Posts: 165
Thanks: 0
bluesaga is on a distinguished road
Default

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.
bluesaga is offline  
Reply With Quote
Old 10-26-2007, 09:24 PM   #4 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

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.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 10-26-2007, 10:34 PM   #5 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

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. :)
Salathe is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 01:31 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design