Hello hope that you can help.
Basically, I'm making a site that uses a header file and then for each page, include the header and set the title.. It's easy using procedural PHP but I want to do it using OO. Here is the problem:
Page.php (class)
<?php
class Page {
protected $title;
protected $header_loc;
protected $mast_desc;
public function __construct($theTitle="", $theHeader="", $mast_head="")
{
}
public function setTitle($theTitle)
{
$this->title = $theTitle;
}
public function _getTitle()
{
return $this->title;
}
}
?>
Header.php
<?php
include ('Page.php');
$header = new Page();
?>
<html class="no-js not-ie" lang="en"><!--<![endif]-->
<head>
<title><?php echo $header->_getTitle; ?></title>
Index.php
<?php
include ('Page.php');
$index = new Page('Welcome to the site', '/headers/header1.php', 'foo bar');
?>
Anyone see where I'm going wrong?
Thanks =)