From 56853211fdce599d82f5e22b4fce693f25670f91 Mon Sep 17 00:00:00 2001 From: screenbeard Date: Sun, 5 Jul 2020 10:51:44 +0930 Subject: [PATCH] Switch to using Plate's 'insert' method for rendering the guid pages --- index.php | 6 ++---- views/guide.php | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/index.php b/index.php index f196d91..67203c4 100644 --- a/index.php +++ b/index.php @@ -109,10 +109,8 @@ if(is_array($match) && is_callable($match['target'])) { case 'guideId': $id = htmlspecialchars($match['params']['id']); - if (file_exists("views/guides/$id.title.php")) { - $guideTitle = file_get_contents("views/guides/$id.title.php"); - $guideContent = file_get_contents("views/guides/$id.content.php"); - echo $templates->render('guide', ['guide_title' => $guideTitle, 'guide_content' => $guideContent]); + if (file_exists("views/guides/$id.title.php") && file_exists("views/guides/$id.content.php")) { + echo $templates->render('guide', ['id' => $id]); } else { echo $templates->render("404"); } diff --git a/views/guide.php b/views/guide.php index 792791e..0c8bdfe 100644 --- a/views/guide.php +++ b/views/guide.php @@ -1,7 +1,7 @@ layout('template.base', ['title' => $title]) ?> -

escape($guide_title)?>

+

insert("guides/$id.title") ?>

Back to guides

- + insert("guides/$id.content") ?>