Refer a class
| From: | Michael Ochs | Date: | Sun, 25 Jul 2004 17:36:44 +0000 |
| Subject: | Refer a class | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-191823@lists.php.net to get a copy of this message | ||
Hi,
I try to load some 'modules' into my class. These modules are other classes.
I want to refer the main class to this new module but that doesn't work. At
the moment it looks like this:
Mainclass:
function loadModule($name) {
if(class_exists($name)) { //Class found
if(!$this->module[$name]) {
$this->module[$name] = new $name(&$this);
}
return true;
} else {
return false;
}
}
The mainfunktion of the module:
function module_artikelvote(&$parent) {
$this->main = &$parent;
return true;
}
I can use $this->main->VARIABLE but the values are old. If I call a function
with $this->main->func_name(); it doesn't work, but there also isn't an
error message!
What's wrong with these functions?
Thanks for help, Michael