forked from Adleraci/adlerka.top
Add article page
This commit is contained in:
43
pages/news/index.php
Normal file
43
pages/news/index.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
require_once "lib/router.php";
|
||||
require_once "lib/newsarticle.php";
|
||||
|
||||
global $routerConfig;
|
||||
|
||||
$output = file_get_contents($routerConfig["template_dir"] . "newsArticles.html");
|
||||
|
||||
$articles_out = "";
|
||||
$articles = getNewsArticles();
|
||||
|
||||
foreach ($articles as $article){
|
||||
$articleTitle = htmlspecialchars($article["Title"]);
|
||||
$articleBody = htmlspecialchars($article["Body"]);
|
||||
$articleFileList = $article["FileList"];
|
||||
$articleWrittenBy = $article["WrittenBy"];
|
||||
$articleWrittenAt = htmlspecialchars($article["WrittenAt"]);
|
||||
$articleWrittenByName = htmlspecialchars($article["Nickname"]);
|
||||
|
||||
$articles_out .= "<article>
|
||||
<h2 class='newstitle'>$articleTitle</h2>
|
||||
<br>
|
||||
<p class='newsauthor'>$articleWrittenByName</p>
|
||||
<p class='newsdate'>$articleWrittenAt</p>
|
||||
<hr>
|
||||
<div class='newsbody'>
|
||||
$articleBody
|
||||
</div>
|
||||
</article>";
|
||||
}
|
||||
|
||||
$output = str_replace("__TEMPLATE__ARTICLES_HERE__", $articles_out, $output);
|
||||
|
||||
return [
|
||||
"output" => $output,
|
||||
"parameters" =>
|
||||
[
|
||||
"minimal_permission_level" => 2,
|
||||
"secret" => "no",
|
||||
"page_title" => "Novinky"
|
||||
]
|
||||
];
|
Reference in New Issue
Block a user