This commit is contained in:
Bruno Rybársky 2024-04-25 23:42:07 +02:00
parent 3074bfc502
commit 2cdac31673
2 changed files with 2 additions and 4 deletions

@ -47,14 +47,13 @@ function renderMemeGallery(): string
// Bind the result variables // Bind the result variables
$stmtlist->bind_result($memeID, $title, $textContent, $createdAt, $filePath, $fileType, $userNickname); $stmtlist->bind_result($memeID, $title, $textContent, $createdAt, $filePath, $fileType, $userNickname);
$stmtlist->execute(); $stmtlist->execute();
$stmtlist->fetch();
$meme_gallery_template = file_get_contents($routerConfig['template_dir'] . 'meme_gallery.html'); $meme_gallery_template = file_get_contents($routerConfig['template_dir'] . 'meme_gallery.html');
// Fetch the results // Fetch the results
$memes_out = ''; $memes_out = '';
while ($stmtlist->fetch()) { while ($stmtlist->fetch()) {
if ($fileType == 'image') { if (str_starts_with($fileType, 'image')) {
$memes_out .= renderMeme($title, $textContent, $createdAt, $filePath, $userNickname); $memes_out .= renderMeme($title, $textContent, $createdAt, $filePath, $userNickname);
} }
} }

@ -20,10 +20,9 @@ foreach ($articles as $article){
$articleTitle = htmlspecialchars($article["Title"]); $articleTitle = htmlspecialchars($article["Title"]);
$articleBody = htmlspecialchars($article["Body"]); $articleBody = htmlspecialchars($article["Body"]);
//$articleFileList = $article["FileList"]; //$articleFileList = $article["FileList"];
$articleWrittenBy = $article["WrittenBy"]; //$articleWrittenBy = $article["WrittenBy"];
$articleWrittenAt = htmlspecialchars($article["WrittenAt"]); $articleWrittenAt = htmlspecialchars($article["WrittenAt"]);
$articleWrittenByName = htmlspecialchars($article["WrittenByName"]); $articleWrittenByName = htmlspecialchars($article["WrittenByName"]);
$articleTemplate = str_replace("__TEMPLATE_ARTICLE_TITLE__", $articleTitle, $articleTemplate); $articleTemplate = str_replace("__TEMPLATE_ARTICLE_TITLE__", $articleTitle, $articleTemplate);
$articleTemplate = str_replace("__TEMPLATE_ARTICLE_AUTHOR__", $articleWrittenByName, $articleTemplate); $articleTemplate = str_replace("__TEMPLATE_ARTICLE_AUTHOR__", $articleWrittenByName, $articleTemplate);
$articleTemplate = str_replace("__TEMPLATE_ARTICLE_DATE__", $articleWrittenAt, $articleTemplate); $articleTemplate = str_replace("__TEMPLATE_ARTICLE_DATE__", $articleWrittenAt, $articleTemplate);