ok i have an index.php as so:
<?php
require 'php/stdlib.php';
$site->page->render();
foreach($page as $var => $value) {
echo $var ." is ". $value." <br/>";
}
?>
the obj creation for site and page is in the stdlib file and is obviously working cuz the -for each- loop prints out:
name is welcome
headers is inc/index_h.php
footers is inc/index_f.php
contents is inc/welcome.php
It show that the object is created. I also did a var dump with proper results here is site---page---render:
public function render_page(){
$this->page->render();
}
here is page---render:
public function render(){
include $this->headers;
include $this->contents;
include $this->footers;
}
however the result of the script is the following:
Undefined variable:
and also
Trying to get property of non-object: both errors point to my $page object that i used in the include file for the page header:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><?php echo $page->name; ?></title>
<script src="/scripts/jquery.js"></script>
</head>
<body>
The errors actually print out in the html title tag not on the screen meaning i have to use View Source on my browser to see it How do i get the $page object to be visible when using an include Im usually pretty good about finding answers myself but this thing has me stumped for two days now.(I have learned alot about many other things while searching for answer tho so I guess not all is lost) If anyone could help me I would greatly appreciate it.
Probably should have added that the page and site object are instantiated in stdlib.php with the following
$site = new csite();
site_ini($site);
$page = new cpage("welcome");
$site->setPage($page);