How about the Config class reads a config file and creates a bunch of definitions.Quote:
Originally Posted by 33degrees
Then we don't have to worry about passing the config object around since the defined constants are accessible everywhere. But having global constants would perhaps break the layering?PHP Code:foreach($config as $name => $value)
define($name, $value);
I've put together an extremely simple INI-parser. Intended use:Quote:
Originally Posted by arborint
Things left to be done:PHP Code:$config = new Config(new IniFileReader('config.ini'));
// ------------------
class Config
{
var $configs = array();
function Config(&$reader)
{
$configs = $reader->parse();
}
}
* Check if the filename given to the reader actually is a .ini-file
* Check if the file actually exists
* ... probably some other checks...
