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") ?>