diff --git a/about.php b/about.php index 9c3a2af..2b96103 100755 --- a/about.php +++ b/about.php @@ -6,4 +6,6 @@ require_once 'twig.php'; // Render template echo $twig->render ( 'about.twig', - array ('title' => 'About')); \ No newline at end of file + array ( + 'page' => 'about', + 'title' => 'About')); diff --git a/css/freepost.styl b/css/freepost.styl index 445744b..f4f665d 100755 --- a/css/freepost.styl +++ b/css/freepost.styl @@ -53,11 +53,18 @@ body width 80% > .flex-item - order 0 - flex 0 1 auto - align-self auto + flex 0 1 auto + align-self auto + order 0 - margin .5em 1em + border 0 + border-bottom 1px solid transparent + margin .5em 1em + padding .2em 0 + + /* Highlight menu item of the current active page (Hot/New/Submit/...) */ + > .active_page + border-bottom 3px solid rgb(255, 175, 50) /* Highlight username if there are unread messages */ .new_messages @@ -317,4 +324,4 @@ body > li float left - margin 0 2em 0 0 \ No newline at end of file + margin 0 2em 0 0 diff --git a/index.php b/index.php index 44bff67..1106ccf 100755 --- a/index.php +++ b/index.php @@ -12,19 +12,23 @@ $db->connect (); // Pagination. What page are we in? if (isset ($_GET['page'])) { - $page = intval ($_GET['page']); + $page_number = intval ($_GET['page']); - if ($page < 0) - $page = 0; + if ($page_number < 0) + $page_number = 0; } else { - $page = 0; + $page_number = 0; } // Retrieve list of posts if (isset ($_GET['new'])) - $posts = $db->get_new_posts ($page); -else - $posts = $db->get_hot_posts ($page); +{ + $posts = $db->get_new_posts ($page_number); + $page = 'new'; +} else { + $posts = $db->get_hot_posts ($page_number); + $page = 'hot'; +} // Retrieve a list of user votes for the posts $IDs = array (); @@ -38,6 +42,7 @@ $votes = $db->get_posts_votes (implode (',', $IDs), Session::get_userid ()); echo $twig->render ( 'index.twig', array( - 'posts' => $posts, - 'votes' => $votes, - 'page' => $page)); + 'posts' => $posts, + 'page' => $page, + 'votes' => $votes, + 'page_number' => $page_number)); diff --git a/login.php b/login.php index 9b87235..dbb9f9c 100755 --- a/login.php +++ b/login.php @@ -114,6 +114,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') echo $twig->render ( 'login.twig', array( + 'page' => 'login', 'title' => 'Login', 'feedback' => isset ($feedback) ? $feedback : '')); diff --git a/submit.php b/submit.php index 06d3e95..3ba66ce 100755 --- a/submit.php +++ b/submit.php @@ -57,4 +57,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') // Render template echo $twig->render ( 'submit.twig', - array ('title' => 'Submit')); + array ( + 'page' => 'submit', + 'title' => 'Submit')); diff --git a/template/header.twig b/template/header.twig index 9d1a786..9c47a35 100755 --- a/template/header.twig +++ b/template/header.twig @@ -33,13 +33,13 @@ diff --git a/template/index.twig b/template/index.twig index 8bcdb59..761cec5 100755 --- a/template/index.twig +++ b/template/index.twig @@ -63,7 +63,7 @@ _\(/_ .:.*_\/_* : /\ : {% endfor %}
- + More