]> git.bts.cx Git - cx.git/blob - cx/templates/public/list.php
Basic support for pagination
[cx.git] / cx / templates / public / list.php
1 <?php cx_template_base('base'); ?>
2 <main>
3 <?php $posts_per_page = cx_site_posts_per_page(); ?>
4 <?php foreach (cx_posts_get(limit: $posts_per_page, offset: $page_number * cx_site_posts_per_page()) as $post): ?>
5 <?php $post_permalink = '/' . date('Y', $post->date) . '/' . date('m', $post->date) . '/' . $post->slug; ?>
6         <article>
7                 <h1><a href="<?= cx_url($post_permalink) ?>"><?= $post->title ?></a></h1>
8                 <p class="updated"><?= date('l, F jS, Y',$post->date) ?></p>
9                 <?php if ($post->html_excerpt): ?>
10                 <?= $post->html_excerpt ?>
11                 <p><a href="<?= cx_url($post_permalink) ?>">Read more...</a></p>
12                 <?php else: ?>
13                 <?= $post->html_content ?>
14                 <?php endif; ?>
15         </article>
16 <?php endforeach; ?>
17
18         <p><a href="<?= cx_url('/page/' . ($page_number + 1) . '/') ?>">Next Posts</a></p>
19 </main>