Files
schachfreunde-badsteben/site/templates/news.php
T
tfeigel 07814712d7 feat: extend news section with tag filtering, improved layout, and homepage integration
Added tag filtering functionality to the blog and news sections, allowing users to filter posts by categories. Enhanced layout with improved tag display, author details, and responsive styling. Integrated the latest news preview into the homepage template. Adjusted visibility logic for navigation arrows in event carousel and refined related PHP snippets for better clarity and reusability.
2025-07-13 12:58:21 +02:00

67 lines
2.2 KiB
PHP

<?php
// FEN in Array umwandeln
function fenToBoard($fen) {
$rows = explode('/', explode(' ', $fen)[0]);
$board = [];
foreach ($rows as $row) {
$boardRow = [];
$chars = str_split($row);
foreach ($chars as $char) {
if (is_numeric($char)) {
for ($i = 0; $i < intval($char); $i++) {
$boardRow[] = '';
}
} else {
$boardRow[] = $char;
}
}
$board[] = $boardRow;
}
return $board;
}?>
<?php snippet('layout', slots: true) ?>
<div class="text-right pb-2">
<?php foreach($page->tags()->split() as $tag): ?>
<a href="<?= page('news')->url(['params' => ['tag' => $tag]]) ?>" class="relative z-10 rounded-full bg-gray-50 px-3 py-1.5 font-medium text-gray-600 hover:bg-gray-100"><?= $tag ?></a>
<?php endforeach; ?>
</div>
<p>
<?= $page->date()->toDate("d.m.Y") ?>
<?php if ($page->subheadline()->isNotEmpty()): ?>
- <?= $page->subheadline() ?>
<?php endif ?>
</p>
<h1><?= $page->headline() ?></h1>
<div>
<img class="w-full rounded-xl object-cover" src="<?= $page->image()->url() ?>" alt="">
</div>
<div class="blockpage">
<?= $page->blocks()->toBlocks() ?>
</div>
<?php if ($user = $page->author()->toUser()): ?>
<div class="mt-6 flex border-t border-b-sf_grau-300 pt-6">
<div class="relative flex items-center gap-x-4">
<img src="<?= $user->avatar()->url() ?>" alt="" class="size-10 rounded-full" />
<div class="text-sm/6">
<p>
<a href="#">
<span class="absolute inset-0"></span>
<div class="text-xl">
<?= $user->username() ?>
</div>
</a>
</p>
<p class="text-sm"><?= $user->role()->title() ?></p>
</div>
</div>
</div>
<?php endif ?>
<?php endsnippet() ?>