From 138f03ce99d31e7fde0666774b9318c441489608 Mon Sep 17 00:00:00 2001 From: Znote Date: Tue, 10 Jan 2017 22:14:16 +0100 Subject: [PATCH] You can now view a specific news post with the view=postid URL GET param, or click the published date of the post. --- index.php | 76 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 20 deletions(-) diff --git a/index.php b/index.php index 607e44c..b641255 100644 --- a/index.php +++ b/index.php @@ -6,6 +6,7 @@ require_once 'engine/init.php'; include 'layout/overall/header.php'; } else { $page = (int)$_GET['page']; } + $view = (isset($_GET['view'])) ? (int)$_GET['view'] : 0; if ($config['allowSubPages'] && file_exists("layout/sub/index.php")) include 'layout/sub/index.php'; else { @@ -72,40 +73,75 @@ require_once 'engine/init.php'; include 'layout/overall/header.php'; } return $string; } - for ($i = $current; $i < $current + $config['news_per_page']; $i++) { - if (isset($news[$i])) { + + if ($view > 0) { // We want to view a specific news post + $si = false; + for ($i = 0; $i < count($news); $i++) if ($view === (int)$news[$i]['id']) $si = $i; + if ($si !== false) { ?> - +
'. $news[$i]['name'] .' - '. TransformToBBCode($news[$i]['title']) .''; ?>'. $news[$si]['name'] .' - '. TransformToBBCode($news[$si]['title']) .''; ?>
-

+

'; - - for ($i = 0; $i < $page_amount; $i++) { - - if ($i == $page) { - - echo ''; - } else { - - echo ''; + ?> + + + + + + + +
News post not found.
+

We failed to find the post you where looking for.

+
+ + + + + + + + +
'.getClock($news[$i]['date'], true).' by '. $news[$i]['name'] .' - '. TransformToBBCode($news[$i]['title']) .''; ?>
+

+
+ '; + + for ($i = 0; $i < $page_amount; $i++) { + + if ($i == $page) { + + echo ''; + + } else { + + echo ''; + } + } + + echo ''; + } - echo ''; - } else { echo '

No news exist.

'; }