From deb20fdfca35c64066fe4e375099350dc77ea408 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Mon, 22 May 2023 15:18:52 -0500 Subject: initial commit --- _classes/Template.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 _classes/Template.php (limited to '_classes/Template.php') diff --git a/_classes/Template.php b/_classes/Template.php new file mode 100644 index 0000000..312e566 --- /dev/null +++ b/_classes/Template.php @@ -0,0 +1,35 @@ +canonicalURL = $canonicalURL; + $this->description = $pageDescription; + $this->title = $pageTitle; + $this->extras = $pageExtras; + $this->content = $contentCol; + $this->comments = $commentSection; + $this->currentYear = date("Y"); + } + + public function echoTemplate() + { + // Get the template file + $templateFile = '_templates/template.html'; + $page = file_get_contents($templateFile); + + // Replace the template variables + $page = str_replace('{Page_Title}', $this->title, $page); + $page = str_replace('{Page_Description}', $this->description, $page); + $page = str_replace('{Canonical_URL}', $this->canonicalURL, $page); + $page = str_replace('{Page_Extras}', $this->extras, $page); + $page = str_replace('{Content_Column}', $this->content, $page); + $page = str_replace('{User_Comments}', $this->comments, $page); + $page = str_replace('{Current_Year}', $this->currentYear, $page); + + // Echo the filled-out template + echo $page; + } +} \ No newline at end of file -- cgit v1.2.3-70-g09d2