diff --git a/lib/newsarticle.php b/lib/newsarticle.php new file mode 100644 index 0000000..2289a24 --- /dev/null +++ b/lib/newsarticle.php @@ -0,0 +1,20 @@ +query("SELECT NewsArticles.ID, NewsArticles.WrittenAt, NewsArticles.WrittenBy, NewsArticles.Title, NewsArticles.Body, NewsArticles.FileList Users.Nickname FROM NewsArticles INNER JOIN Users ON NewsArticles.WrittenBy = Users.ID; "); + + // Check if the query executed Successfully + if ($result) { + while ($row = $result->fetch_assoc()) { + $articles[] = $row; + } + } + } + + return $articles; +} \ No newline at end of file diff --git a/pages/news/index.html b/pages/news/index.html deleted file mode 100644 index 34116ae..0000000 --- a/pages/news/index.html +++ /dev/null @@ -1,8 +0,0 @@ - -
-

-

Adlerka študentské news

-
-

Rohová časť stola v a A103 spáchala samovraždu po dotyku Richarda Mikloša!!!

-
- diff --git a/pages/news/index.php b/pages/news/index.php new file mode 100644 index 0000000..528549a --- /dev/null +++ b/pages/news/index.php @@ -0,0 +1,43 @@ + +

$articleTitle

+
+

$articleWrittenByName

+

$articleWrittenAt

+
+
+$articleBody +
+"; +} + +$output = str_replace("__TEMPLATE__ARTICLES_HERE__", $articles_out, $output); + +return [ + "output" => $output, + "parameters" => + [ + "minimal_permission_level" => 2, + "secret" => "no", + "page_title" => "Novinky" + ] +]; diff --git a/templates/newsArticles.html b/templates/newsArticles.html new file mode 100644 index 0000000..8645f78 --- /dev/null +++ b/templates/newsArticles.html @@ -0,0 +1,6 @@ +
+

+

Adlerka študentské news

+
+ __TEMPLATE__ARTICLES_HERE__ +