Re: [PHP] OOP, dynamic class extention
From: Marek Kilimajer (kilimajer_at_webglobe.sk)
Date: 10/30/03
- Next message: Patrick Fowler: "new install php not working. Please help."
- Previous message: Jough Jeaux: "Re: [PHP] OOP, dynamic class extention"
- In reply to: Jackson Miller: "OOP, dynamic class extention"
- Next in thread: Jackson Miller: "Re: [PHP] OOP, dynamic class extention"
- Reply: Jackson Miller: "Re: [PHP] OOP, dynamic class extention"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Oct 2003 19:29:20 +0100 To: Jackson Miller <jackson@coldfeetcreative.com>
php is not c, you can't use constants this way.
Jackson Miller wrote:
> I want to be able to set a base class in a settings file, and then have other
> classes extend the base class, but PHP won't let me do what I have tried.
>
> I get the following error:
> Fatal error: Class cepweb: Cannot inherit from undefined class my_base_class
> in /home/me/my_child_class.php on line 10
>
> ex:
> <?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_CLASSFILE {
> // yada yada
> }
> ?>
>
> Any thoughts on ways to overcome this?
>
> I have tried using a variable instead of a constant, but it didn't work.
>
> -Jackson
>
- Next message: Patrick Fowler: "new install php not working. Please help."
- Previous message: Jough Jeaux: "Re: [PHP] OOP, dynamic class extention"
- In reply to: Jackson Miller: "OOP, dynamic class extention"
- Next in thread: Jackson Miller: "Re: [PHP] OOP, dynamic class extention"
- Reply: Jackson Miller: "Re: [PHP] OOP, dynamic class extention"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|