From: Tony B. <to...@to...> - 2003-03-26 15:15:35
|
On Sat, 22 Mar 2003, Jason Sweat wrote: > require_once('config.php'); > require is a directive, not a function, so > require_once 'config.php'; > is better form, mentioned in the PEAR coding conventions as acceptable either > way, but I have been dinged in professional writing elsewhere for including the > parens. I made this change, thanks for pointing it out. > > $_CONF is a bad name for a variable. It looks like a superglobal, but clearly > is note. It also ad-hears to the PEAR coding conventions definititions of a > define, not a global variable. Actually PEAR says globals should start with underscore, followed by package name followed by variable name. Since the use of $_CONF was not specific to the MVC package, rather, for use in the app itself, I renamed it to $gConf for now. > > If you have these constants defined: > // General configuration settings > define('_BASE_URL', 'baseurl'); > define('_MVC_BASE', 'dirbase'); Per PEAR coding standards all _<varname> constants are now named MVC_<varname> > in Controller::Controller() > $_SESSION['MVC_message'] = ''; > Should 'MVC_message' also be a define? I tend to like to use defines for all > "magic" indexes, that way there is less risk of me mis-typing an assignment > index. Good point, I have added MVC_MESSAGE and MVC_ERRORS as constants > > I would move the $configData initialization into the config.php script. This > makes the "bootstrap" (index.php) file more understandable, and it is after > all, configuration, which seems like it belongs in the "config" script. Ok, what I have done is I have moved all the config data to mvcconfig.php. In preparation for XML support I have also created a mvcconfig.xml. Individual apps can name these file what ever they want. Point here is you are right, the config data should be pulled. I also refactored a few things so that the ArrayLoader and XMLLoader work the same. The way I had before required unique logic in the LoaderFactory which , obviously, doesn't make much sense. > The discussion of the $var[foo][bar] vs $var = array('foo'=>array('bar'=>...)); > came up on the Phrame list earlier. I said I was ambivilent then, but looking > at it: I too am ambivilent. I think in the end the XML configuration will be the default as it is easier to read and easier for developers to learn. I will repost the updated code here as soon as the XML configuration is working. -- Tony Bibbs "I guess you have to remember that those who don't to...@to... hunt or fish often see those of us who do as harmlessly strange and sort of amusing. When you think about it, that might be a fair assessment." --Unknown |