Exactly... But it any case why can't you use constants in a class? "const" keyword in PHP5.Gambler wrote:I don't see why not. Configuration can be seen as a set of defaults.onfigurations generally should not ever be altered at run times
Custom Application Frameworks - What would you include?
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
I agree for the most part...but I use multi-dimensional arrays for a reason and that is to remove my configuration from any typical namespace...Jcart wrote:configurations generally should not ever be altered at run times, so your best bet is typically a constant.Hockey wrote:Just out of curiosity...why use a 'Config' class???
Do you include update/delete file operations in these classes for easy end user changes???
I personally just use an multi-dimensional array...
Code: Select all
$GLOBALS['PRODNAME']['CONFIG']['SECTION'] = 'Some string or array maybe';I don't wish to develop in PHP5 yet
For those reasons and a few others I always use multidimensional arrays...which aren't easily modified at runtime
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
I think it's a matter of opinion really...Gambler wrote:I don't see why not. Configuration can be seen as a set of defaults.onfigurations generally should not ever be altered at run times
IMHO however configuration is a static entity...there not variables in the typical sense...when changed it should be a 'hard' change.
Configuration I consider application wide...as in...every user sees any changes made...whereas settings are more geared towards user experience or user profile, etc...
Settings I typically store in a database for obvious reasons...but again...being stored in a database kinda makes them static in a runtime variable sense.
This is just my opinion of course
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Thats what I would do if the option was available in anything less than PHP4...d11wtq wrote:Exactly... But it any case why can't you use constants in a class? "const" keyword in PHP5.Gambler wrote:I don't see why not. Configuration can be seen as a set of defaults.onfigurations generally should not ever be altered at run times
Until I switch to 5...I'll rely on good old fashioned disipline(sp.)