From e2f14f5cf48d264beb6a981364ca4242b1c548de Mon Sep 17 00:00:00 2001 From: zPlus <-> Date: Fri, 18 Mar 2016 07:43:02 +0100 Subject: [PATCH] Add title to pages --- about.php | 4 +++- login.php | 4 +++- post.php | 1 + submit.php | 4 +++- template/header.twig | 2 +- user.php | 5 ++++- 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/about.php b/about.php index 2fd349dc..9c3a2afe 100644 --- a/about.php +++ b/about.php @@ -4,4 +4,6 @@ require_once 'session.php'; require_once 'twig.php'; // Render template -echo $twig->render ('about.twig'); \ No newline at end of file +echo $twig->render ( + 'about.twig', + array ('title' => 'About')); \ No newline at end of file diff --git a/login.php b/login.php index 770dbf5f..70d7baf1 100644 --- a/login.php +++ b/login.php @@ -96,5 +96,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') // Render template echo $twig->render ( 'login.twig', - array('feedback' => isset ($feedback) ? $feedback : '')); + array( + 'title' => 'Login', + 'feedback' => isset ($feedback) ? $feedback : '')); diff --git a/post.php b/post.php index a029aeea..0af8ae70 100644 --- a/post.php +++ b/post.php @@ -65,6 +65,7 @@ $comments = $db->get_post_comments ($post['id']); echo $twig->render ( 'post.twig', array( + 'title' => $post['title'], 'post' => $post, 'comments' => $comments, 'votes' => $votes)); diff --git a/submit.php b/submit.php index 03447cc3..6f905c06 100644 --- a/submit.php +++ b/submit.php @@ -42,4 +42,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') } // Render template -echo $twig->render ('submit.twig'); +echo $twig->render ( + 'submit.twig', + array ('title' => 'Submit')); diff --git a/template/header.twig b/template/header.twig index cfe3738b..196ab078 100644 --- a/template/header.twig +++ b/template/header.twig @@ -8,7 +8,7 @@ - freepost + {{ title is defined ? title ~ ' - ' }}freepost diff --git a/user.php b/user.php index 6dca4a6d..3feb93e4 100644 --- a/user.php +++ b/user.php @@ -52,11 +52,14 @@ if (isset ($_GET['username'])) echo $twig->render ( 'user.twig', array ( + 'title' => $user['username'], 'profile' => 'public', 'other_user' => $user)); } else { // Show private page echo $twig->render ( 'user.twig', - array ('profile' => 'private')); + array ( + 'title' => Session::get_username (), + 'profile' => 'private')); } \ No newline at end of file