Hello,
I am having trouble with objects and include pages. All of the pages run from one index.php file. This file calls a require_once for a config file, and a core.php class file. Next, the index.php file creates an instance of the core class using:
$core = new core;
If I run the following code in the index.php file, it shows true (1):
$test = is_object($core);
echo $test;
However, if I run this test on a page that index.php includes after the instance of core has been stated, it shows false (blank).
If I try to call a method of core from the included page, I get this message:
Fatal error: Call to a member function on a non-object in...
If I call the following code from the included page, it works:
$core = new core;
I would like to create an instance of the class only once per script execution, so I can use it on all pages without the worry of creating a new instance for every page.
Does anyone know what I could be doing wrong, or if there is a setting I missed?
Thanks for your help,
Matt