Create annotated Starterkit

This commit is contained in:
Sonja Broda
2019-07-28 15:07:33 +02:00
parent 40f095f5de
commit aada11ac43
29 changed files with 305 additions and 21 deletions

View File

@@ -1,13 +1,27 @@
<?php
/**
* Templates render the content of your pages.
* They contain the markup together with some control structures like loops or if-statements.
* This example template makes use of the `$gallery` variable defined in the `album.php` controller
* and the `cover()` method defined in the `album.php` page model.
* Snippets like the header and footer contain markup used in multiple templates. They also help to keep templates clean.
* More about templates: https://getkirby.com/docs/guide/templates/basics
*/
?>
<?php snippet('header') ?>
<main class="album">
<article>
<header>
<?php if ($cover = $page->cover()): ?>
<?php
// in this line of code, `cover` does not call the field of the same name but the `cover` method defined in the page model
// before we use the `crop()` file method, we make sure to check if the file exists to prevent errors
if ($cover = $page->cover()): ?>
<figure class="album-cover">
<?= $cover->crop(1024, 768) ?>
<figcaption>
<!-- The `or()` method is great to provide a fallback value if a field is empty -->
<h1><?= $page->headline()->or($page->title()) ?></h1>
</figcaption>
</figure>