Skip to content

Instantly share code, notes, and snippets.

@starckio
Created November 11, 2013 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save starckio/7413310 to your computer and use it in GitHub Desktop.
Save starckio/7413310 to your computer and use it in GitHub Desktop.
<?php snippet('header') ?>
<section class="content cf">
<?php if(param('tag')) {
$articles = $pages->find('blog')
->children()
->visible()
->filterBy('tags', param('tag'), ',')
->flip()
->paginate(10);
} else {
$articles = $pages->find('blog')
->children()
->visible()
->flip()
->paginate(5);
} ?>
<?php if ( $page->children()->visible()->count() ) : foreach($articles as $article): ?>
<article>
<time datetime="<?php echo $article->date('c') ?>" pubdate="pubdate">
<?php echo $article->date('d.m.Y') ?>
</time>
<h3><a href="<?php echo $article->url() ?>"><?php echo html($article->title()) ?></a></h3>
</article>
<?php endforeach; else : ?>
<article class="no-items">
<?php echo kirbytext($page->text()) ?>
</article>
<?php endif; ?>
<?php if($articles->pagination()->hasPages()): ?>
<nav class="pagination cf">
<?php if($articles->pagination()->hasNextPage()): ?>
<a class="next" href="<?php echo $articles->pagination()->nextPageURL() ?>">&lsaquo; Newer</a>
<?php endif ?>
<?php if($articles->pagination()->hasPrevPage()): ?>
<a class="prev" href="<?php echo $articles->pagination()->prevPageURL() ?>">Older &rsaquo;</a>
<?php endif ?>
</nav>
<?php endif ?>
</section>
<?php snippet('footer') ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment