From c115370510cf6178845172f9a48137f24bd14177 Mon Sep 17 00:00:00 2001 From: deepend-tildeclub <58404188+deepend-tildeclub@users.noreply.github.com> Date: Sat, 17 Aug 2024 08:49:36 -0600 Subject: [PATCH] Update index.php --- index.php | 76 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 54 insertions(+), 22 deletions(-) diff --git a/index.php b/index.php index be5a465..ceefb62 100644 --- a/index.php +++ b/index.php @@ -13,34 +13,66 @@ = new DateTime($newsItem['date'])) { - echo '
' . htmlspecialchars($newsItem['content']) . '
'; + // Sort news items by date, most recent first + usort($news, function ($a, $b) { + return strtotime($b['date']) - strtotime($a['date']); + }); - if (isset($newsItem['details']) && is_array($newsItem['details'])) { - echo '' . htmlspecialchars($newsItem['note']) . '
'; - } - - if (isset($newsItem['additional_content'])) { - echo '' . htmlspecialchars($newsItem['additional_content']) . '
'; - } - - echo '' . htmlspecialchars($newsItem['content']) . '
'; + + if (isset($newsItem['details']) && is_array($newsItem['details'])) { + echo '' . htmlspecialchars($newsItem['note']) . '
'; + } + + if (isset($newsItem['additional_content'])) { + echo '' . htmlspecialchars($newsItem['additional_content']) . '
'; + } + + echo 'tilde.club is not a social network it is one tiny totally