44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
|
<?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"
|
||
|
]
|
||
|
];
|