48 lines
2.0 KiB
PHP
48 lines
2.0 KiB
PHP
|
|
<?php
|
||
|
|
$pageTitle = $title ?? 'Post';
|
||
|
|
$contentHtml = $content_html ?? '';
|
||
|
|
$publishedAt = $published_at ?? '';
|
||
|
|
$featuredImage = $featured_image_url ?? '';
|
||
|
|
$authorName = $author_name ?? '';
|
||
|
|
$category = $category ?? '';
|
||
|
|
$tags = $tags ?? '';
|
||
|
|
ob_start();
|
||
|
|
?>
|
||
|
|
<section class="card">
|
||
|
|
<div class="badge">News</div>
|
||
|
|
<h1 style="margin-top:12px; font-size:30px;"><?= htmlspecialchars($pageTitle, ENT_QUOTES, 'UTF-8') ?></h1>
|
||
|
|
<?php if ($publishedAt !== '' || $authorName !== '' || $category !== ''): ?>
|
||
|
|
<div style="font-size:12px; color:var(--muted); margin-top:6px;">
|
||
|
|
<?php if ($publishedAt !== ''): ?>
|
||
|
|
<?= htmlspecialchars($publishedAt, ENT_QUOTES, 'UTF-8') ?>
|
||
|
|
<?php endif; ?>
|
||
|
|
<?php if ($authorName !== ''): ?>
|
||
|
|
<?php if ($publishedAt !== ''): ?> · <?php endif; ?>
|
||
|
|
<?= htmlspecialchars($authorName, ENT_QUOTES, 'UTF-8') ?>
|
||
|
|
<?php endif; ?>
|
||
|
|
<?php if ($category !== ''): ?>
|
||
|
|
<?php if ($publishedAt !== '' || $authorName !== ''): ?> · <?php endif; ?>
|
||
|
|
<?= htmlspecialchars($category, ENT_QUOTES, 'UTF-8') ?>
|
||
|
|
<?php endif; ?>
|
||
|
|
</div>
|
||
|
|
<?php endif; ?>
|
||
|
|
<?php if ($featuredImage !== ''): ?>
|
||
|
|
<img src="<?= htmlspecialchars($featuredImage, ENT_QUOTES, 'UTF-8') ?>" alt="" style="width:100%; border-radius:16px; margin-top:16px;">
|
||
|
|
<?php endif; ?>
|
||
|
|
<div style="margin-top:14px; color:var(--muted); line-height:1.8;">
|
||
|
|
<?= $contentHtml ?>
|
||
|
|
</div>
|
||
|
|
<?php if ($tags !== ''): ?>
|
||
|
|
<div style="margin-top:16px; display:flex; flex-wrap:wrap; gap:6px;">
|
||
|
|
<?php foreach (array_filter(array_map('trim', explode(',', (string)$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; ?>
|
||
|
|
</section>
|
||
|
|
<?php
|
||
|
|
$content = ob_get_clean();
|
||
|
|
require __DIR__ . '/../../../views/site/layout.php';
|