59 lines
1.2 KiB
PHP
59 lines
1.2 KiB
PHP
<?php
|
|
|
|
|
|
class Page
|
|
{
|
|
private $pagecontent = '';
|
|
private $title = '';
|
|
private $navigation = '';
|
|
|
|
//default boilerplate html code
|
|
private $template = '
|
|
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<title>$$TITLE$$</title>
|
|
</head>
|
|
<body>
|
|
<nav>
|
|
$$NAVIGATION$$
|
|
</nav>
|
|
<div>
|
|
$$PAGECONTENT$$
|
|
</div>
|
|
</body>
|
|
</html>
|
|
';
|
|
|
|
public function __construct()
|
|
{
|
|
|
|
}
|
|
|
|
public function __destruct($title)
|
|
{
|
|
$this->title = $title;
|
|
}
|
|
|
|
public function addContent($content)
|
|
{
|
|
$this->pagecontent .= $content;
|
|
}
|
|
|
|
public function setTemplate($template){
|
|
$this->template = $template;
|
|
}
|
|
|
|
public function setNavigation($navigation){
|
|
$this->navigation = $navigation;
|
|
}
|
|
|
|
public function displayPage(){
|
|
$page = $this->template;
|
|
$page = str_replace('$$TITLE$$', $this->title, $page);
|
|
$page = str_replace('$$NAVIGATION$$', $this->navigation, $page);
|
|
$page = str_replace('$$PAGECONTENT$$', $this->pagecontent, $page);
|
|
|
|
echo $page;
|
|
}
|
|
} |