
<?php // Page class class Page { // Declare a class member variable var $page; var $title; var $year; var $copyright; // The Constructor function function Page($title, $year, $copyright){ // Assign values to member variables $this->page = ''; $this->title = $title; $this->year = $year; $this->copyright = $copyright; // Call the addHeader() method $this->addHeader(); } // Generates the top of the page function addHeader(){ $this->page .= <<<EOD <html> <head> <title>$this->title</title> </head> <body> <h1 align="center">$this->title</h1> </body> EOD; } } ?>
source share