From 2cdac316737ca5e9933a24f4196c4d046865fb2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Thu, 25 Apr 2024 23:42:07 +0200 Subject: [PATCH] MEME --- lib/meme.php | 3 +-- pages/news/index.php | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/meme.php b/lib/meme.php index c2c4b7b..26f83fd 100644 --- a/lib/meme.php +++ b/lib/meme.php @@ -47,14 +47,13 @@ function renderMemeGallery(): string // Bind the result variables $stmtlist->bind_result($memeID, $title, $textContent, $createdAt, $filePath, $fileType, $userNickname); $stmtlist->execute(); - $stmtlist->fetch(); $meme_gallery_template = file_get_contents($routerConfig['template_dir'] . 'meme_gallery.html'); // Fetch the results $memes_out = ''; while ($stmtlist->fetch()) { - if ($fileType == 'image') { + if (str_starts_with($fileType, 'image')) { $memes_out .= renderMeme($title, $textContent, $createdAt, $filePath, $userNickname); } } diff --git a/pages/news/index.php b/pages/news/index.php index 44fa2ed..bad0da3 100644 --- a/pages/news/index.php +++ b/pages/news/index.php @@ -20,10 +20,9 @@ foreach ($articles as $article){ $articleTitle = htmlspecialchars($article["Title"]); $articleBody = htmlspecialchars($article["Body"]); //$articleFileList = $article["FileList"]; - $articleWrittenBy = $article["WrittenBy"]; + //$articleWrittenBy = $article["WrittenBy"]; $articleWrittenAt = htmlspecialchars($article["WrittenAt"]); $articleWrittenByName = htmlspecialchars($article["WrittenByName"]); - $articleTemplate = str_replace("__TEMPLATE_ARTICLE_TITLE__", $articleTitle, $articleTemplate); $articleTemplate = str_replace("__TEMPLATE_ARTICLE_AUTHOR__", $articleWrittenByName, $articleTemplate); $articleTemplate = str_replace("__TEMPLATE_ARTICLE_DATE__", $articleWrittenAt, $articleTemplate);