diff --git a/_sakura/templates/yuuno/elements/newsPost.tpl b/_sakura/templates/yuuno/elements/newsPost.tpl index 6f638b0..f979c46 100644 --- a/_sakura/templates/yuuno/elements/newsPost.tpl +++ b/_sakura/templates/yuuno/elements/newsPost.tpl @@ -1,4 +1,4 @@ -{{ newsPost.title }} +{% if page.articleCount > 1 %}{{ newsPost.title }}{% endif %}
diff --git a/_sakura/templates/yuuno/main/news.tpl b/_sakura/templates/yuuno/main/news.tpl index cb2bff8..e6581dd 100644 --- a/_sakura/templates/yuuno/main/news.tpl +++ b/_sakura/templates/yuuno/main/news.tpl @@ -1,41 +1,55 @@ {% include 'global/header.tpl' %}
- - {% for newsPost in newsPosts %} - {% include 'elements/newsPost.tpl' %} - {% endfor %} +
{% if page.articleCount == 1 %}{{ newsPosts[0].title }}{% elseif page.articleCount < 1 %}Post does not exist!{% else %}News {% endif %}
+ {% if page.articleCount >= 1 %} + {% for newsPost in newsPosts %} + {% include 'elements/newsPost.tpl' %} + {% endfor %} + {% else %} +
+

The requested news post does not exist!

+ There are a few possible reasons for this; +
    +
  • The post may have been deleted due to irrelevancy.
  • +
  • The post never existed.
  • +
+
+ {% endif %}
-
- -
+ /* * * DO NOT EDIT BELOW THIS LINE * * */ + (function () { + var s = document.createElement('script'); s.async = true; + s.type = 'text/javascript'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; + (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); + }()); + + {% elseif page.articleCount == 1 %} +
+
+ + + comments powered by Disqus + {% endif %}
- - - comments powered by Disqus {% include 'global/footer.tpl' %} diff --git a/main/index.php b/main/index.php index 79d17d9..44c86ac 100644 --- a/main/index.php +++ b/main/index.php @@ -10,9 +10,10 @@ namespace Sakura; require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php'; // Add page specific things +$renderData['newsPosts'] = Main::getNewsPosts(3); $renderData['page'] = [ 'title' => 'Flashii Dev', - 'newsComments' => false + 'articleCount' => count($renderData['newsPosts']) ]; $renderData['stats'] = [ 'userCount' => ($userCount = count($users = Users::getAllUsers())) .' user'. ($userCount == 1 ? '' : 's'), @@ -20,7 +21,6 @@ $renderData['stats'] = [ 'lastRegDate' => ($lastRegDate = date_diff(date_create(date('Y-m-d', max($users)['regdate'])), date_create(date('Y-m-d')))->format('%a')) .' day'. ($lastRegDate == 1 ? '' : 's'), 'chatOnline' => ($chatOnline = 0) .' user'. ($chatOnline == 1 ? '' : 's') ]; -$renderData['newsPosts'] = Main::getNewsPosts(3); // Print page contents print Main::tplRender('main/index.tpl', $renderData); diff --git a/main/news.php b/main/news.php index 608a03d..162afa7 100644 --- a/main/news.php +++ b/main/news.php @@ -12,8 +12,8 @@ require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sak // Add page specific things $renderData['newsPosts'] = Main::getNewsPosts((isset($_GET['id']) && !isset($_GET['xml']) && is_numeric($_GET['id'])) ? $_GET['id'] : null, (isset($_GET['id']) && !isset($_GET['xml']) && is_numeric($_GET['id']))); $renderData['page'] = [ - 'title' => 'Flashii News', - 'newsComments' => false + 'articleCount' => ($postCount = count($renderData['newsPosts'])), + 'title' => (isset($_GET['id']) ? ($postCount ? $renderData['newsPosts'][0]['title'] : 'Post does not exist!') : 'Flashii News'), ]; // News XML, don't really care so yeah