I have a problem. When I run my site, the template error errors.
I get these two errors:
Notice: Undefined variable: template in /home/us22368/domains/******.nl/public_html/index.php on line 4
Fatal error: Call to a member function writePage() on a non-object in /home/us22368/domains/******.nl/public_html/index.php on line 4
Some code:
index.php:
<?php
require_once('global.php');
$template->writePage('index');
$template->echoPage();
?>
My global.php includes this class (class.template.php) :
<?php
if (!class_exists('template')) {
class template {
public $template;
public function writePage($pageName) {
$file = 'app/themes/' . THEME . '/' . $pageName . '.html';
if(!file_exists($file)) {
die('The Page You Asked for does not exist.');
} else {
$this->content .= file_get_contents($file);
}
}
public function echoPage() {
echo $this->content;
}
}
}
?>
Is there anyone who can help me?