Using this function I want to create a PHP navigation:
function loadPage($pagename) {
if (!isset($pagename) || !file_exists($pagename . '.php')) {
include FRONTPAGE . '.php';
} else {
include $pagename . '.php';
}
}
In my index I have the following:
require 'includes/classes/core.php';
$core = new SH_Core();
I can access all the other classes from $core like $core->database->newConnection(); And I should be able to use that in the included file too. But I can't:
Notice: Undefined variable: core in C:\Users\Development\Development applications\localhost\htdocs\Shuze\frontpage.php on line 4
Notice: Trying to get property of non-object in C:\Users\Development\Development applications\localhost\htdocs\Shuze\frontpage.php on line 4
Fatal error: Call to a member function newConnection() on a non-object in C:\Users\Development\Development applications\localhost\htdocs\Shuze\frontpage.php on line 4