Re: Re: Discussion of method -- config files

From: Date: Fri, 20 Jun 2008 16:34:24 +0000
Subject: Re: Re: Discussion of method -- config files
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-275712@lists.php.net to get a copy of this message
At 12:11 PM -0400 6/20/08, Robert Cummings wrote:
For instance I define multiple aliases databases and perform a lookup into the database configuration via the key: $GLOBALS['interJinn']['databases'] = array (
    'db1' => array( /* config */ ),
    'db2' => array( /* config */ ),
    'db3' => array( /* config */ ),
    'db4' => array( /* config */ ),
); Then request it: $db = &$mDb->getConnection( 'db1' ); Which would lookup the db: if( isset( $GLOBALS['interJinn']['databases'][$dbKey] ) ) {
    $config = $GLOBALS['interJinn']['databases'][$dbKey];
} This is a gross oversimplification of what happens, but essentially a lookup occurs at some point. It seems with constants I'd have to do some fancy string concatenation and checking for defined constants via dynamically built strings since each database configuration would be broken out into a set of scalar constant.
That's damned slick -- as I said, it pays to read your post. Thanks, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com

« previous php.general (#275712) next »