From 7af5e037847e3ed3bc758b9865fc406cb69b0523 Mon Sep 17 00:00:00 2001 From: Dale Davies Date: Thu, 14 Jul 2022 11:40:13 +0100 Subject: [PATCH] Tidy up AbstractPage class --- jumpapp/classes/Pages/AbstractPage.php | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/jumpapp/classes/Pages/AbstractPage.php b/jumpapp/classes/Pages/AbstractPage.php index 0194e7c..cc7b506 100644 --- a/jumpapp/classes/Pages/AbstractPage.php +++ b/jumpapp/classes/Pages/AbstractPage.php @@ -32,24 +32,11 @@ abstract class AbstractPage { abstract protected function render_content(): string; - protected function render_header(): string { - $template = $this->mustache->loadTemplate('header'); - return $template->render([ - 'noindex' => $this->config->parse_bool($this->config->get('noindex')), - 'title' => $this->config->get('sitename'), - 'owmapikey' => !!$this->config->get('owmapikey', false), - 'metrictemp' => $this->config->parse_bool($this->config->get('metrictemp')) - ]); - } + abstract protected function render_header(): string; - protected function render_footer(): string { - $template = $this->mustache->loadTemplate('footer'); - return $template->render([ - 'showclock' => $this->config->parse_bool($this->config->get('showclock')) - ]); - } + abstract protected function render_footer(): string; - protected function render_page(): void { + protected function build_page(): void { $this->outputarray = [ $this->render_header(), $this->render_content(), @@ -58,7 +45,7 @@ abstract class AbstractPage { } public function get_output(): string { - $this->render_page(); + $this->build_page(); return implode('', $this->outputarray); }