Skip to content

Instantly share code, notes, and snippets.

@NiklasJordan
Forked from bastianallgeier/kirby_loop.php
Created February 7, 2012 22:29
Show Gist options
  • Save NiklasJordan/1762581 to your computer and use it in GitHub Desktop.
Save NiklasJordan/1762581 to your computer and use it in GitHub Desktop.
Loop (getkirby.com)
<?php snippet('header') ?>
<?php foreach($page->children()->flip() as $article): ?>
<?php if($article->template() == 'link'): ?>
<!-- link html -->
<?php elseif($article->template() == 'article'): ?>
<article class="text">
<header><h1><a href="<?php echo $article->url() ?>"><?php echo html($article->title()) ?></a></h1></header>
<section>
<?php echo kirbytext($article->text()) ?>
</section>
</article>
<?php endif ?>
<?php endforeach ?>
<?php snippet('footer') ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment