Michael Fesser <ne*****@gmx.ne t> wrote in message
Fatal error: Class mcbasic: Cannot inherit from undefined class mcbase
in /usr/local/www/vhosts/publicpen.com/htdocs/designer/ppKernel/McBasic.php
on line 5
The question is: Are both classes stored in the same file? Apparently
not. So you have to include the base-class before you can extend it,
e.g.
require_once 'mcbase.php';
Thanks. Now I got it working. But McBasic doesn't seem to have its
constructor called when it is the parent of another class. I've been
trying to test, as you'll see here:
class McBasic extends McBase {
var $controllerForA ll = null;
var $resultsObject = null;
var $notifyObject = null;
var $historyObject = null;
/**
*
*
* 06-14-04 - most objects in the PDS content management system should
be
* descended from McBasic. This provides basic servies to all its
child
* classes. All the classes that themselves contain no other objects
can
* safely be put here, and then become services available to all child
* classes.
*
*
*
*
*/
function McBasic() {
// a test for debugging
echo "hello<br>" ;
$this->controllerForA ll = & getController() ;
if (is_object($thi s->controllerForA ll)) {
echo "this is an object";
} else {
echo "this is not an object";
}
$this->resultsObjec t = &
$this->controllerForA ll->getObject("McR esults", " in the constructor
of McBasic.");
$this->notifyObject = &
$this->controllerForA ll->getObject("McN otify", " in the constructor of
McBasic.");
$this->historyObjec t = &
$this->controllerForA ll->getObject("McH istory", " in the constructor
of McBasic.");
}
}
But in the class McArrangements, I have this line:
class McArrangements extends McBasic {
Yes McArrangements throws an error whenever I use the 4 objects that
are set in the constructor of McBasic. The error says that there is no
such object. For instance, I get an error on this line in
McArrangements:
$this->resultsObjec t->error("In setControlPanel CbId(), in the class
McArrangements, we expected the method's parameter to be a number, but
instead we got this: $cbId ", "McArrangements ");
So I decided to write a test for McBasic, and the test revealed that
everything was working for McBasic. In the test, I call McBasic
directly, and at the end of the constructor I test to see if
$this->resultsObjec t is an object. It tests true. Yet when I refer to
$this->resultsObjec t in McArrangements, I get "No such object". How
can this be?