Custom Application Frameworks - What would you include?

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Gambler wrote:
onfigurations generally should not ever be altered at run times
I don't see why not. Configuration can be seen as a set of defaults.
Exactly... But it any case why can't you use constants in a class? "const" keyword in PHP5.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

Jcart wrote:
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... :)
configurations generally should not ever be altered at run times, so your best bet is typically a constant.
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...

Code: Select all

$GLOBALS['PRODNAME']['CONFIG']['SECTION'] = 'Some string or array maybe';
Also, constants aren't available in PHP 4 (as you likely know)...except as define in which case it allows nothing other than scalars...many config settings in my apps are arrays, etc...

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

Post by alex.barylski »

Gambler wrote:
onfigurations generally should not ever be altered at run times
I don't see why not. Configuration can be seen as a set of defaults.
I think it's a matter of opinion really...

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

Post by alex.barylski »

d11wtq wrote:
Gambler wrote:
onfigurations generally should not ever be altered at run times
I don't see why not. Configuration can be seen as a set of defaults.
Exactly... But it any case why can't you use constants in a class? "const" keyword in PHP5.
Thats what I would do if the option was available in anything less than PHP4...

Until I switch to 5...I'll rely on good old fashioned disipline(sp.) :)
Post Reply