From 39634829a9d964eb1e4218c139e55648f5e227c9 Mon Sep 17 00:00:00 2001 From: flashwave Date: Sun, 29 Mar 2015 22:54:30 +0200 Subject: [PATCH] is this going to work --- _sakura/components/Main.php | 11 +++++++++++ _sakura/components/Users.php | 2 +- _sakura/templates/yuuno/main/index.tpl | 4 +++- main/index.php | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/_sakura/components/Main.php b/_sakura/components/Main.php index 81f9fab..1c7c1ae 100644 --- a/_sakura/components/Main.php +++ b/_sakura/components/Main.php @@ -144,4 +144,15 @@ class Main { } + // Getting news posts + public static function getNewsPosts($limit = null) { + + // Get news posts + $newsPosts = Database::fetch('news', true, null, ['id', true], ($limit ? [$limit] : null)); + + // Return posts + return $newsPosts; + + } + } diff --git a/_sakura/components/Users.php b/_sakura/components/Users.php index e4a31bf..8aa7e26 100644 --- a/_sakura/components/Users.php +++ b/_sakura/components/Users.php @@ -60,7 +60,7 @@ class Users { } - // Get all users + // Get all groups public static function getAllGroups() { // Execute query diff --git a/_sakura/templates/yuuno/main/index.tpl b/_sakura/templates/yuuno/main/index.tpl index 5eb2455..2a3c074 100644 --- a/_sakura/templates/yuuno/main/index.tpl +++ b/_sakura/templates/yuuno/main/index.tpl @@ -13,7 +13,9 @@
News
- {{ users.1.username }} + {% for newsPost in newsPosts %} + {% include 'elements/newsPost.tpl' %} + {% endfor %}
diff --git a/main/index.php b/main/index.php index 5f5500a..9a6b82a 100644 --- a/main/index.php +++ b/main/index.php @@ -13,6 +13,7 @@ require_once '/var/www/flashii.net/_sakura/sakura.php'; $renderData['page'] = [ 'title' => 'Flashii Dev' ]; +$renderData['newsPosts'] = Main::getNewsPosts(3); // Print page contents print Main::$_TPL->render('main/index.tpl', $renderData);