Files
laysense.cn/app/view/archive.php

29 lines
1.5 KiB
PHP

<?php
use App\Content\View;
$e = View::escape(...);
?>
<section class="section article-page" aria-labelledby="archive-title" data-enter>
<div class="wrap">
<div class="section-heading">
<?php if ($backPath): ?><a class="back-link" href="<?= $e($backPath) ?>"><?= $e($backLabel) ?></a><?php endif ?>
<h1 id="archive-title"><?= $e($headline) ?></h1>
<p><?= $e($description) ?></p>
</div>
<nav class="filter-nav" aria-label="动态分类">
<a href="<?= $e($allPath) ?>" <?= !$category && !$tag ? 'aria-current="page"' : '' ?>>全部</a>
<?php foreach ($categories as $key => $label): ?>
<a href="<?= $e($categoryLinks[$key]) ?>" <?= $category === (string) $key ? 'aria-current="page"' : '' ?>><?= $e($label) ?></a>
<?php endforeach ?>
</nav>
<?= View::fragment('article-list', ['articles' => $articles, 'categoryScope' => $categoryScope ?? null]) ?>
<?php if ($pageNumber > 1 || $hasNext): ?>
<nav class="pagination" aria-label="动态分页">
<?php if ($pageNumber > 1): ?><a class="button button-outline" href="<?= $e(View::archivePage($archivePath, $pageNumber - 1)) ?>" rel="prev">上一页</a><?php endif ?>
<span>第 <?= $e($pageNumber) ?> 页</span>
<?php if ($hasNext): ?><a class="button button-outline" href="<?= $e(View::archivePage($archivePath, $pageNumber + 1)) ?>" rel="next">下一页</a><?php endif ?>
</nav>
<?php endif ?>
</div>
</section>