krz/hn

A brutalist web client for Hacker News.

clone: git clone https://gitbay.org/krz/hn.git

53488151f29e3afbd1b1348597ff2123b97ad2d7

unsigned

author: Christian Cleberg <hello@cleberg.net> · 2023-06-14T20:05:14Z

extract template file string for better compatibility
 index.php                   | 2 +-
 src/View/class-template.php | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/index.php b/index.php
index 76e3556..f85b25b 100644
--- a/index.php
+++ b/index.php
@@ -230,7 +230,7 @@ function echo_html(string $page_url, string $page_description, string $page_titl
         $page_content
     );
 
-    $template->echo_template();
+    $template->echo_template('templates/template.html');
 }
 
 // EOF
diff --git a/src/View/class-template.php b/src/View/class-template.php
index f0bfdcd..9a3c598 100644
--- a/src/View/class-template.php
+++ b/src/View/class-template.php
@@ -38,9 +38,8 @@ class Template
 		$this->current_year = date("Y");
 	}
 
-	public function echo_template() {
+	public function echo_template(string $template_file) {
 		// Get the template file
-		$template_file = 'templates/template.html';
 		$page = file_get_contents($template_file);
 
 		// Replace the template variables