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,9 +1,17 @@
<?php
/**
* Templates render the content of your pages.
* They contain the markup together with some control structures like loops or if-statements.
* This example templates only echos the field values from the content file and doesn't need any special logic from a controller.
* Snippets like the header, footer and intro 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>
<header class="intro">
<h1><?= $page->title() ?></h1>
</header>
<?php snippet('intro') ?>
<div class="layout">

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>

View File

@@ -1,9 +1,17 @@
<?php
/**
* Templates render the content of your pages.
* They contain the markup together with some control structures like loops or if-statements.
* This default template must not be removed. It is used whenever Kirby cannot find a template with the name of the content file.
* Snippets like the header, footer and intro 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>
<header class="intro">
<h1><?= $page->title() ?></h1>
</header>
<?php snippet('intro') ?>
<div class="text">
<?= $page->text()->kt() ?>
</div>

View File

@@ -1,17 +1,32 @@
<?php
/**
* Templates render the content of your pages.
* They contain the markup together with some control structures like loops or if-statements.
* This home template renders content from others pages, the children of the `photography` page to display a nice gallery grid.
* 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>
<header class="intro">
<h1><?= $site->title() ?></h1>
</header>
<?php snippet('intro') ?>
<?php if ($photographyPage = page('photography')): ?>
<?php
// we always use an if-statement to check if a page exists to prevent errors
// in case the page was deleted or renamed before we call a method like `children()` in this case
if ($photographyPage = page('photography')): ?>
<ul class="grid">
<?php foreach ($photographyPage->children()->listed() as $album): ?>
<li>
<a href="<?= $album->url() ?>">
<figure>
<?php if ($cover = $album->cover()): ?>
<?php
// the `cover()` method defined in the `album.php` page model can be used
// everywhere across the site for this type of page
if ($cover = $album->cover()): ?>
<?= $cover->resize(1024, 1024) ?>
<?php endif ?>
<figcaption>

View File

@@ -1,3 +1,13 @@
<?php
/**
* Templates render the content of your pages.
* They contain the markup together with some control structures like loops or if-statements.
* This template is responsible for rendering all the subpages of the `notes` page.
* 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>

View File

@@ -1,9 +1,18 @@
<?php
/**
* Templates render the content of your pages.
* They contain the markup together with some control structures like loops or if-statements.
* This template lists all all the subpages of the `notes` page with their title date sorted by date and links to each subpage.
* Snippets like the header, footer and intro 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>
<header class="intro">
<h1><?= $page->title() ?></h1>
</header>
<?php snippet('intro') ?>
<div class="notes">
<?php foreach ($page->children()->listed()->sortBy('date', 'desc') as $note): ?>

View File

@@ -1,9 +1,18 @@
<?php
/**
* Templates render the content of your pages.
* They contain the markup together with some control structures like loops or if-statements.
* This template lists all all the subpages of the `phototography` page with title and cover image.
* Snippets like the header, footer and intro 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>
<header class="intro">
<h1><?= $page->title() ?></h1>
</header>
<?php snippet('intro') ?>
<ul class="albums"<?= attr(['data-even' => $page->children()->listed()->isEven()], ' ') ?>>
<?php foreach ($page->children()->listed() as $album): ?>