2015-04-21 17:11:43 +02:00
|
|
|
<?php namespace Todaymade\Daux;
|
|
|
|
|
|
|
|
class SimplePage implements Page
|
|
|
|
{
|
|
|
|
protected $title;
|
|
|
|
protected $content;
|
|
|
|
protected $html = null;
|
|
|
|
|
2015-04-23 00:32:30 +02:00
|
|
|
public function __construct($title, $content)
|
|
|
|
{
|
|
|
|
$this->initializePage($title, $content);
|
2015-04-21 17:11:43 +02:00
|
|
|
}
|
|
|
|
|
2015-04-23 00:32:30 +02:00
|
|
|
public function display()
|
|
|
|
{
|
2015-04-21 17:11:43 +02:00
|
|
|
header('Content-type: text/html; charset=utf-8');
|
2015-04-23 00:32:30 +02:00
|
|
|
echo $this->getContent();
|
2015-04-21 17:11:43 +02:00
|
|
|
}
|
|
|
|
|
2015-04-23 00:32:30 +02:00
|
|
|
public function getContent()
|
|
|
|
{
|
2015-04-21 17:11:43 +02:00
|
|
|
if (is_null($this->html)) {
|
2015-04-23 00:32:30 +02:00
|
|
|
$this->html = $this->generatePage();
|
2015-04-21 17:11:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return $this->html;
|
|
|
|
}
|
|
|
|
|
2015-04-23 00:32:30 +02:00
|
|
|
private function initializePage($title, $content)
|
|
|
|
{
|
|
|
|
$this->title = $title;
|
|
|
|
$this->content = $content;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function generatePage()
|
|
|
|
{
|
2015-04-21 17:11:43 +02:00
|
|
|
return $this->content;
|
|
|
|
}
|
|
|
|
}
|