deadjournal/views/post/view.php
2025-01-08 22:46:44 +05:00

39 lines
1.1 KiB
PHP
Executable File

<div class="post">
<h2><?= e($post['title']) ?></h2>
<p><small>Published: <?= e($post['created_at']) ?></small></p>
<div>
<?= nl2br($post['content']) ?> </div>
<?php if (!empty($tags)): ?>
<p class="tags">
Tags:
<?php
$separator = '';
foreach ($tags as $tag) {
// Print the separator (which is empty for the first tag, then becomes ", ")
echo $separator;
$url = HOME_DIRECTORY . 'index.php?url=post/tag/' . e($tag['name']);
$name = e($tag['name']);
// Output the link for this tag
echo '<a href="' . $url . '">' . $name . '</a>';
// Now that we've printed one tag, change separator to ", "
$separator = ', ';
}
?>
</p>
<?php endif; ?>
<?php if (isAdmin()): ?>
<p>
<a href="<?= HOME_DIRECTORY ?>index.php?url=admin/edit/<?= e($post['id']) ?>">
Edit
</a>
</p>
<?php endif; ?>
</div>