This one time, at band camp, Roman Neuhauser wrote:
BTW, here is my class: class returnConfigParams { var $a; var $b; var $c; var $d; function getMySQLParams() { include($_SERVER['DOCUMENT_ROOT']."/properties.php"); $values = array(0 => $a, 1 => $b, 2 => $c, 3 => $d); return($values); } }
Why not a static method? Create a config singleton and you can have an instance of your class available anywhere by simply using config::getInstance() class config{ /*** Declare instance ***/ private static $instance = NULL; /** * * the constructor is set to private so * so nobody can create a new instance using new * */ private function __construct() { /*** nothing to see, move along ***/ } /** * * Return an array instance * * @access public * * @return array * */ public static function getInstance() { if (!self::$instance) { /*** set this to the correct path and add some error checking ***/ include($_SERVER['DOCUMENT_ROOT']."/properties.php"); self::$instance = array($a, $b, $C); } return self::$instance; } /** * * Like the constructor, we make __clone private * so nobody can clone the instance * */ private function __clone(){ } } /*** end of class ***/ Just a thought Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php