Fatal error: Cannot pass parameter 1 by reference in /home/shadowlight/public_html/test/libs/global.lib.php on line 296
code:
function load(&$class){
global $$class;
$$class = new $class;
$this->loaded[$class] = 1;
$$class->setup(); // Run constructor
if(!is_object($$class)){
return false;
}
return true;
}
}
Danny Shepherd wrote:
Hello,
Adding the following as the first line of overall->load() should solve your
problem.
global $$class;
HTH,
Danny.
----- Original Message -----
From: "Tularis"
To:
Sent: Thursday, November 14, 2002 8:18 PM
Subject: [PHP] OOP-related question
>Hey,
>I have the following script:
>class overall {
>
>function overall(){
>$this->loaded['overall'] =1;
>
>function load($class){
>
>$$class = new $class;
>$this->loaded[$class] = 1;
>
>$$class->setup(); // Run constructor
>
>if(!is_object($$class)){
>return false;
>}
>return true;
>}
>}
>
>then I have a few classes, which hold a setup() function as thei
>'constructor'. Then, I do this:
>
>$overall = new overall;
>$overall->load('debug');
>
>this should load the debug class. I want it to load to $debug->, but it
>won't even load to $overall->debug
>
>It's not really a *need* to have this, it's just something that will
>help me in keeping control over all classes. I don't want to use new
>class, because this way it would be easier to 'instruct' the
>'constructor' of those new classes to change the values of the vars to a
>specific one, without calling for something weird...
>
>anyway, it doesn't work, and it doesn't spit out an error either.
>Any ideas?
>
>- Tularis
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php