62 lines
3.2 KiB
PHP
62 lines
3.2 KiB
PHP
|
|
<?php
|
||
|
|
$pageTitle = $title ?? 'News';
|
||
|
|
$posts = $posts ?? [];
|
||
|
|
$page = $page ?? null;
|
||
|
|
ob_start();
|
||
|
|
?>
|
||
|
|
<section class="card">
|
||
|
|
<div class="badge">News</div>
|
||
|
|
<?php if ($page && !empty($page['content_html'])): ?>
|
||
|
|
<div style="margin-top:12px; color:var(--muted); line-height:1.7;">
|
||
|
|
<?= (string)$page['content_html'] ?>
|
||
|
|
</div>
|
||
|
|
<?php else: ?>
|
||
|
|
<h1 style="margin-top:12px; font-size:30px;">Latest Updates</h1>
|
||
|
|
<p style="color:var(--muted); margin-top:8px;">News, updates, and announcements.</p>
|
||
|
|
<?php endif; ?>
|
||
|
|
|
||
|
|
<div style="margin-top:18px; display:grid; gap:12px;">
|
||
|
|
<?php if (!$posts): ?>
|
||
|
|
<div style="color:var(--muted);">No posts yet.</div>
|
||
|
|
<?php else: ?>
|
||
|
|
<?php foreach ($posts as $post): ?>
|
||
|
|
<article style="padding:14px 16px; border-radius:16px; border:1px solid rgba(255,255,255,0.12); background: rgba(0,0,0,0.25);">
|
||
|
|
<div style="font-size:11px; text-transform:uppercase; letter-spacing:0.28em; color:var(--muted);">Post</div>
|
||
|
|
<h2 style="margin:8px 0 6px; font-size:22px;"><?= htmlspecialchars((string)($post['title'] ?? ''), ENT_QUOTES, 'UTF-8') ?></h2>
|
||
|
|
<?php if (!empty($post['featured_image_url'])): ?>
|
||
|
|
<img src="<?= htmlspecialchars((string)$post['featured_image_url'], ENT_QUOTES, 'UTF-8') ?>" alt="" style="width:100%; border-radius:12px; margin:10px 0;">
|
||
|
|
<?php endif; ?>
|
||
|
|
<?php if (!empty($post['published_at'])): ?>
|
||
|
|
<div style="font-size:12px; color:var(--muted); margin-bottom:8px;"><?= htmlspecialchars((string)$post['published_at'], ENT_QUOTES, 'UTF-8') ?></div>
|
||
|
|
<?php endif; ?>
|
||
|
|
<div style="font-size:12px; color:var(--muted); margin-bottom:8px;">
|
||
|
|
<?php if (!empty($post['author_name'])): ?>
|
||
|
|
<?= htmlspecialchars((string)$post['author_name'], ENT_QUOTES, 'UTF-8') ?>
|
||
|
|
<?php endif; ?>
|
||
|
|
<?php if (!empty($post['category'])): ?>
|
||
|
|
<?php if (!empty($post['author_name'])): ?> · <?php endif; ?>
|
||
|
|
<?= htmlspecialchars((string)$post['category'], ENT_QUOTES, 'UTF-8') ?>
|
||
|
|
<?php endif; ?>
|
||
|
|
</div>
|
||
|
|
<p style="color:var(--muted); line-height:1.6;">
|
||
|
|
<?= htmlspecialchars((string)($post['excerpt'] ?? ''), ENT_QUOTES, 'UTF-8') ?>
|
||
|
|
</p>
|
||
|
|
<?php if (!empty($post['tags'])): ?>
|
||
|
|
<div style="margin-top:8px; display:flex; flex-wrap:wrap; gap:6px;">
|
||
|
|
<?php foreach (array_filter(array_map('trim', explode(',', (string)$post['tags'] ?? ''))) as $tag): ?>
|
||
|
|
<span style="font-size:11px; color:#c8ccd8; border:1px solid rgba(255,255,255,0.15); padding:4px 8px; border-radius:999px;">
|
||
|
|
<?= htmlspecialchars((string)$tag, ENT_QUOTES, 'UTF-8') ?>
|
||
|
|
</span>
|
||
|
|
<?php endforeach; ?>
|
||
|
|
</div>
|
||
|
|
<?php endif; ?>
|
||
|
|
<a href="/news/<?= htmlspecialchars((string)($post['slug'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" style="display:inline-flex; margin-top:10px; font-size:12px; text-transform:uppercase; letter-spacing:0.2em; color:#9ad4ff;">Read more</a>
|
||
|
|
</article>
|
||
|
|
<?php endforeach; ?>
|
||
|
|
<?php endif; ?>
|
||
|
|
</div>
|
||
|
|
</section>
|
||
|
|
<?php
|
||
|
|
$content = ob_get_clean();
|
||
|
|
require __DIR__ . '/../../../views/site/layout.php';
|