Posted on 2003-11-22
I'm making a website with a very large set of classes. I only want to initialize 1 class in the main script. That class, called BaseSystem, initializes the other classes. Sometimes I need to get information from the parent-class. But I really don't know how to substract this information. Currently I'm doing it this way:
$this->this_settings['uid'] = "_guest";
$this->this_settings['sid'] = session_id();
$this->this_settings['pid'] = "_home";
$this->this_settings['database_admin_email'] = $in_array;
$this->requesturl = new RequestUrl(& $this, $in_array);
$this->database = new Database(& $this, array($in_array, $in_array, $in_array, $in_array));
$this->error = new Error(& $this);
The classes RequestUrl and Database currently don't require information from the parent class (BaseSystem). The Error class does need information.
$this->parent = $par;
function GenerateError($text, $pid)
$errorpid = $this->parent->GetVar("pid");
header("Location: " . $this->parent->requesturl->GetUrl("_error") . " \r\n");
My problem is, that I want a hierarchy of classes, which can interact with eachother and which is saved in a session. Currently I don't get the correct information from the $this->parent var. I get the information from the moment, the error-class was instantiated. How can I use a hierarchy of classes?
Thanks in advance!!!