support for stylesheets

This commit is contained in:
Göran Heinemann 2021-05-12 16:02:56 +02:00
parent 575e2b5a85
commit 6590cee305
Signed by: goeranh
GPG Key ID: D9EC7BA4C5BF1EEC
1 changed files with 14 additions and 3 deletions

View File

@ -6,6 +6,7 @@ class Page
private $pagecontent = '';
private $title = '';
private $navigation = '';
private $style = '';
//default boilerplate html code
private $template = '
@ -13,6 +14,7 @@ class Page
<html lang="de">
<head>
<title>$$TITLE$$</title>
$$STYLE$$
</head>
<body>
<nav>
@ -40,17 +42,26 @@ class Page
$this->pagecontent .= $content;
}
public function setTemplate($template){
public function setTemplate($template)
{
$this->template = $template;
}
public function setNavigation($navigation){
public function setNavigation($navigation)
{
$this->navigation = $navigation;
}
public function displayPage(){
public function addStylesheet($stylesheet)
{
$this->style .= '<link rel="stylesheet" href="' . $stylesheet . '">';
}
public function displayPage()
{
$page = $this->template;
$page = str_replace('$$TITLE$$', $this->title, $page);
$page = str_replace('$$STYLE$$', $this->style, $page);
$page = str_replace('$$NAVIGATION$$', $this->navigation, $page);
$page = str_replace('$$PAGECONTENT$$', $this->pagecontent, $page);