Page 1 of 1
Site config file
Posted: Sun Jul 11, 2010 11:34 pm
by Todlerone
Hello everyone and thank-you in advance for any help/suggestions. I have recently learned to code with OOP and have redone all of my function based code over to OOP. I have a much better grasp on the OOP way of programming and really enjoy it. The next thing I would like to do is setup a site config file that I can establish alot of my main variables. Should I make it a *.php file that you open once a year and edit or could/should it be placed in an MySQL table and allow for easier editing? Any help into the safest/best direction for this is very much appreciated.
CHEERS
Re: Site config file
Posted: Mon Jul 12, 2010 12:15 am
by requinix
I'd say to put it in a config file. If it gets used a lot and hardly ever changes then sticking it all in a database just means more overhead.
Re: Site config file
Posted: Mon Jul 12, 2010 12:20 am
by liljester
IMO it depends on your preference. for me, if i want users to update the config, i put those settings in a database and create an interface to change them. if it is only settings that i will be editing, then sure a file is fine. however, i would never use a .php file for a file im including.. the only files that have php extensions are the ones that you intend to have execute, a setting file for me is typically an include (or require) file, and i save them with .inc extensions so they cannot be executed.
Re: Site config file
Posted: Mon Jul 12, 2010 8:50 pm
by Todlerone
TY to the both of you for your responses. The file I need only needs to be edited once a year at the beginning of the baseball year. Things like start of season, end of season, etc. Right now I make the changes in passed variables to the constructor in the class. I want to allow conveners to set this up themselves. The range of computer competent conveners scares me a little with editing a config file vs a database. Could editing a config file be made to be relatively simple and safe?
TY
Re: Site config file
Posted: Mon Jul 12, 2010 11:26 pm
by liljester
not really.. no.. they would have to be alble to somehow log into the server, find the correct file, open it in an editor of some sort, make the correct changes.. lol so i would say no. if you want non-programmers to make the changes just build a quick form that loads the current values into inputs from the database and stick a "save" button on the bottom of it.
Re: Site config file
Posted: Mon Jul 12, 2010 11:38 pm
by Todlerone
Thanks for the response. I totally agree. Cheers