Classes and Global vars
| From: | Robert Covell | Date: | Wed, 04 Oct 2000 20:31:12 +0000 |
| Subject: | Classes and Global vars | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-18654@lists.php.net to get a copy of this message | ||
Having a heck of a time accessing vars defined in another file
(config.php3). I am using php4.0.2 and have a simple test class.
The config file:
<?
$MESSAGE = "Test message...";
?>
The class:
<?
require("config.php3");
class testclass
{
var $message = $MESSAGE;
function print_message()
{
return $this->message;
}
}
?>
When I do:
<?
$theclass=new testclass;
echo $theclass->message;
I get:
Parse error: parse error in /usr/local/apache/htdocs/testclass.lib on line 6
Fatal error: Cannot instantiate non-existent class: testclass in
/usr/local/apache/htdocs/test2.php on line 5
I have no idea why. Tried to include it, and just about everything I can
think of and have no idea. Any ideas...
-Bob