|
Posted by somaboy mx on 12/21/05 13:24
Is there a way to see the value of a constant that is defined outside of the
class body from within the class?
I need to do something like this, but it isn't working:
// in one file I define these settings
define('_DBUSER_', 'me');
define('_DBPASS_', 'secret');
define('_DBHOST_', 'localhost:3306');
define('_DBNAME_', 'mydb');
// then include this file in the file with the class definition
include('settings.inc');
class DBWrapper
{
var $dbuser;
var $dbpass;
var $dbhost;
var $dbname;
function DBWrapper()
{
$this->dbuser = _DBUSER_;
$this->dbpass = _DBPASS_;
$this->dbhost = _DBHOST_;
$this->dbname = _DBNAME_;
}
// ...
}
thank you,
..soma
Navigation:
[Reply to this message]
|