index.php

main 39 lines · 1.3 KB Raw
Alex Alex Commit Initial commit 01/10/2026 09:20
1<?php
2/**
3 * View for the front page (index.php).
4 *
5 * A view is the middle block of one root page - the part between the header
6 * and the footer. The page's logic already ran: every variable it prepared is
7 * available here.
8 *
9 * This theme only ships this one view. Every other page of the site falls back
10 * to layouts/default/views/, wrapped in THIS theme's shell and styled by THIS
11 * theme's CSS. Add views/highscores.php the day you want to restyle that page,
12 * and not before.
13 */
14?>
15<h1>Welcome to <?= theme_title() ?></h1>
16
17<p>
18 You are looking at <code>layouts/_example/views/index.php</code>.
19 The rest of the site is running on the default theme's views, dressed by
20 this theme.
21</p>
22
23<?php
24$news = fetchAllNews();
25if (is_array($news)):
26 foreach (array_slice($news, 0, (int)($config['news_per_page'] ?? 5)) as $article): ?>
27 <article class="well">
28 <h2><?= htmlspecialchars((string)$article['title'], ENT_QUOTES, 'UTF-8') ?></h2>
29 <p class="txt">
30 <?= htmlspecialchars(getClock((int)$article['date'], true), ENT_QUOTES, 'UTF-8') ?>
31 by <?= htmlspecialchars((string)($article['name'] ?? ''), ENT_QUOTES, 'UTF-8') ?>
32 </p>
33 <div><?= $article['text'] ?></div>
34 </article>
35 <?php endforeach;
36else: ?>
37 <p>No news posted yet. Write one from the admin panel.</p>
38<?php endif; ?>
39
Top