On Thursday 30 October 2003 02:15 pm, Marek Kilimajer wrote:
> Can you show it once again. In your first email you use a constant, not
> variable.
Sure.  In my first email I said that I had tried with a variable too (but 
didn't show the code).

Ex1 gives a "cannot inherit from undefined class" error
Ex2 gives a "parse error, expecting T_STRING"

Ex1 (with constants):
<?php

// settings to be set on install of the app
define("MY_BASE_CLASS","base_class");
define("MY_BASE_CLASSFILE","base_class.php");

// require the class file
require_once(MY_BASE_CLASSFILE);

class my_child_class extends MY_BASE_CLASS {
    // yada yada
}
?>

Ex2 (with variables):
<?php

// settings to be set on install of the app
define("MY_BASE_CLASS","base_class");
define("MY_BASE_CLASSFILE","base_class.php");
$my_base_class_var = MY_BASE_CLASS;

// require the class file
require_once(MY_BASE_CLASSFILE);

class my_child_class extends $my_base_class_var {
    // yada yada
}
?>

Also, just to be clear:

base_class.php
<?php

class base_class {
    function base_class() {
        echo "it works";
        return true;
    }
}
?>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to