Is it a good idea?

From: Date: Sat, 20 Nov 2004 12:36:31 +0000
Subject: Is it a good idea?
Groups: php.general 
Request: Send a blank email to php-general+get-202556@lists.php.net to get a copy of this message
Hi guys, In my framework I have some classes that depends from others (like authentication depends of database)... So I wrote is method inside the framework class, and I would like to know if is it an intelligent solution or not: class dependent { function dependent (&$framework) { $independent =& $framework->load_core_class('independent'); } } AND THE LOADING METHOD: function load_core_class($class='') { if(!class_exists($class)) { if(file_exists($this->core_dir.$class.'.class.php')) { include_once($this->core_dir.$class.'.class.php'); return $this->core->$class =& new $class($this); } else { return false; } } elseif(!isset($this->core->$class)) { return $this->core->$class =& new $class($this); } else { return $this->core->$class; } } Best regards to you all, Bruno B B Magalhaes

« previous php.general (#202556) next »