Design adjustments, new content and more

This commit is contained in:
Bastian Allgeier
2020-12-10 16:10:45 +01:00
parent c378376bc9
commit 4d7b192c94
103 changed files with 1695 additions and 1003 deletions

View File

@@ -1,61 +1,53 @@
<?php
/**
* Templates render the content of your pages.
* They contain the markup together with some control structures like loops or if-statements.
* The `$page` variable always refers to the currently active page.
* To fetch the content from each field we call the field name as a method on the `$page` object, e.g. `$page->title()`.
* 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
*/
/*
Templates render the content of your pages.
They contain the markup together with some control structures
like loops or if-statements. The `$page` variable always
refers to the currently active page.
To fetch the content from each field we call the field name as a
method on the `$page` object, e.g. `$page->title()`.
This about page example uses the content from our layout field
to create most parts of the page and keeps it modular. Only the
contact box at the bottom is pre-defined with a set of fields
in the about.yml blueprint.
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') ?>
<?php snippet('intro') ?>
<?php snippet('layouts', ['field' => $page->layout()]) ?>
<main>
<?php snippet('intro') ?>
<div class="layout">
<aside>
<section>
<h2>Address</h2>
<div class="text">
<?= $page->address()->kt() ?>
</div>
</section>
<section>
<h2>Email</h2>
<div class="text">
<?= html::email($page->email()) ?>
</div>
</section>
<section>
<h2>Phone</h2>
<div class="text">
<?= html::tel($page->phone()) ?>
</div>
</section>
<section>
<h2>On the web</h2>
<div class="text">
<ul>
<?php foreach ($page->social()->toStructure() as $social): ?>
<li><?= html::a($social->url(), $social->platform()) ?></li>
<?php endforeach ?>
</ul>
</div>
</section>
</aside>
<div class="text">
<?= $page->text()->kt() ?>
</div>
<aside class="contact">
<h2 class="h1">Get in contact</h2>
<div class="grid" style="--gutter: 1.5rem">
<section class="column text" style="--columns: 4">
<h3>Address</h2>
<?= $page->address()->kt() ?>
</section>
<section class="column text" style="--columns: 4">
<h3>Email</h2>
<p><?= html::email($page->email()) ?></p>
<h3>Phone</h2>
<p><?= html::tel($page->phone()) ?></p>
</section>
<section class="column text" style="--columns: 4">
<h3>On the web</h2>
<ul>
<?php foreach ($page->social()->toStructure() as $social): ?>
<li><?= html::a($social->url(), $social->platform()) ?></li>
<?php endforeach ?>
</ul>
</section>
</div>
</main>
</aside>
</div>
<?php snippet('footer') ?>

View File

@@ -1,55 +1,47 @@
<?php
/**
* Templates render the content of your pages.
* They contain the markup together with some control structures like loops or if-statements.
* The `$page` variable always refers to the currently active page.
* To fetch the content from each field we call the field name as a method on the `$page` object, e.g. `$page->title()`.
* 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
*/
/*
Templates render the content of your pages.
They contain the markup together with some control structures
like loops or if-statements. The `$page` variable always
refers to the currently active page.
To fetch the content from each field we call the field name as a
method on the `$page` object, e.g. `$page->title()`.
This example template makes use of the `$gallery` variable defined
in the `album.php` controller (/site/controllers/album.php)
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') ?>
<article>
<?php snippet('intro') ?>
<div class="grid">
<main class="album">
<article>
<header>
<?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>
<?php endif ?>
</header>
<div class="album-text text">
<?= $page->description()->kt() ?>
<?php if ($page->tags()->isNotEmpty()): ?>
<p class="album-tags tags"><?= $page->tags() ?></p>
<?php endif ?>
<div class="column" style="--columns: 4">
<div class="text">
<?= $page->text() ?>
</div>
</div>
<ul class="album-gallery"<?= attr(['data-even' => $gallery->isEven(), 'data-count' => $gallery->count()], ' ') ?>>
<?php foreach ($gallery as $image): ?>
<li>
<figure>
<a href="<?= $image->link()->or($image->url()) ?>">
<?= $image->crop(800, 1000) ?>
<div class="column" style="--columns: 8">
<ul class="album-gallery">
<?php foreach ($gallery as $image): ?>
<li>
<a href="<?= $image->url() ?>" data-lightbox>
<figure class="img" style="--w:<?= $image->width() ?>;--h:<?= $image->height() ?>">
<?= $image->resize(800) ?>
</figure>
</a>
</figure>
</li>
<?php endforeach ?>
</ul>
</article>
</main>
</li>
<?php endforeach ?>
</ul>
</div>
</article>
<?php snippet('footer') ?>

View File

@@ -1,22 +1,30 @@
<?php
/**
* Templates render the content of your pages.
* They contain the markup together with some control structures like loops or if-statements.
* The `$page` variable always refers to the currently active page.
* To fetch the content from each field we call the field name as a method on the `$page` object, e.g. `$page->title()`. *
* 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
*/
/*
Templates render the content of your pages.
They contain the markup together with some control structures
like loops or if-statements. The `$page` variable always
refers to the currently active page.
To fetch the content from each field we call the field name as a
method on the `$page` object, e.g. `$page->title()`.
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 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>
<?php snippet('intro') ?>
<article>
<h1 class="h1"><?= $page->title() ?></h1>
<div class="text">
<?= $page->text()->kt() ?>
</div>
</main>
</article>
<?php snippet('footer') ?>

View File

@@ -1,34 +1,49 @@
<?php
/**
* Templates render the content of your pages.
* They contain the markup together with some control structures like loops or if-statements.
* The `$page` variable always refers to the currently active page.
* To fetch the content from each field we call the field name as a method on the `$page` object, e.g. `$page->title()`.
* 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
*/
/*
Templates render the content of your pages.
They contain the markup together with some control structures
like loops or if-statements. The `$page` variable always
refers to the currently active page.
To fetch the content from each field we call the field name as a
method on the `$page` object, e.g. `$page->title()`.
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>
<?php snippet('intro') ?>
<?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
/*
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
*/
?>
<?php if ($photographyPage = page('photography')): ?>
<ul class="home-grid">
<?php foreach ($photographyPage->children()->listed() as $album): ?>
<li>
<a href="<?= $album->url() ?>">
<figure>
<?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()): ?>
<?php
/*
The `cover()` method defined in the `album.php`
page model can be used everywhere across the site
for this type of page
We can automatically resize images to a useful
size with Kirby's built-in image manipulation API
*/
?>
<?php if ($cover = $album->cover()): ?>
<?= $cover->resize(1024, 1024) ?>
<?php endif ?>
<figcaption>
@@ -42,7 +57,4 @@
<?php endforeach ?>
</ul>
<?php endif ?>
</main>
<?php snippet('footer') ?>

View File

@@ -1,31 +1,59 @@
<?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.
* The `$page` variable always refers to the currently active page.
* To fetch the content from each field we call the field name as a method on the `$page` object, e.g. `$page->title()`.
* 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
*/
?>
/*
Templates render the content of your pages.
They contain the markup together with some control structures
like loops or if-statements. The `$page` variable always
refers to the currently active page.
To fetch the content from each field we call the field name as a
method on the `$page` object, e.g. `$page->title()`.
This note template renders a blog article. It uses the `$page->cover()`
method from the `note.php` page model (/site/models/page.php)
It also receives the `$tag` variable from its controller
(/site/controllers/note.php) if a tag filter is activated.
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>
<article class="note">
<header class="note-header intro">
<h1><?= $page->title() ?></h1>
<time class="note-date"><?= $page->date()->toDate('d F Y') ?></time>
<?php if ($page->tags()->isNotEmpty()) : ?>
<p class="note-tags tags"><?= $page->tags() ?></p>
<?php endif ?>
</header>
<?php if ($cover = $page->cover()): ?>
<a href="<?= $cover->url() ?>" data-lightbox class="img" style="--w:2; --h:1">
<?= $cover->crop(1200, 600) ?>
</a>
<?php endif ?>
<div class="note-text text">
<?= $page->text()->kt() ?>
</div>
</article>
</main>
<article class="note">
<header class="note-header h1">
<h1 class="note-title"><?= $page->title() ?></h1>
<?php if ($page->subheading()->isNotEmpty()): ?>
<p class="note-subheading"><small><?= $page->subheading() ?></small></p>
<?php endif ?>
</header>
<div class="note text">
<?= $page->text()->toBlocks() ?>
</div>
<footer class="note-footer">
<?php if (!empty($tags)): ?>
<ul class="note-tags">
<?php foreach ($tags as $tag): ?>
<li>
<a href="<?= $page->parent()->url(['params' => ['tag' => $tag]]) ?>"><?= $tag ?></a>
</li>
<?php endforeach ?>
</ul>
<?php endif ?>
<time class="note-date" datetime="<?= $page->date('c') ?>">Published on <?= $page->date() ?></time>
</footer>
<?php snippet('prevnext') ?>
</article>
<?php snippet('footer') ?>

View File

@@ -1,34 +1,46 @@
<?php
/**
* Templates render the content of your pages.
* They contain the markup together with some control structures like loops or if-statements.
* The `$page` variable always refers to the currently active page.
* To fetch the content from each field we call the field name as a method on the `$page` object, e.g. `$page->title()`.
* 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
*/
?>
/*
Templates render the content of your pages.
They contain the markup together with some control structures
like loops or if-statements. The `$page` variable always
refers to the currently active page.
To fetch the content from each field we call the field name as a
method on the `$page` object, e.g. `$page->title()`.
This template lists all the subpages of the `notes` page with
their title date sorted by date and links to each subpage.
This template receives additional variables like $tag and $notes
from the `notes.php` controller in `/site/controllers/notes.php`
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>
<?php if (empty($tag) === false): ?>
<header class="h1">
<h1>
<small>Tag:</small> <?= html($tag) ?>
<a href="<?= $page->url() ?>">&times;</a>
</h1>
</header>
<?php else: ?>
<?php snippet('intro') ?>
<?php endif ?>
<ul class="grid">
<?php foreach ($notes as $note): ?>
<li class="column" style="--columns: 4">
<?php snippet('note', ['note' => $note]) ?>
</li>
<?php endforeach ?>
</ul>
<div class="notes">
<?php foreach ($page->children()->listed()->sortBy('date', 'desc') as $note): ?>
<article class="note">
<header class="note-header">
<a href="<?= $note->url() ?>">
<h2><?= $note->title() ?></h2>
<time><?= $note->date()->toDate('d F Y') ?></time>
</a>
</header>
</article>
<?php endforeach ?>
</div>
</main>
<?php snippet('pagination', ['pagination' => $notes->pagination()]) ?>
<?php snippet('footer') ?>

View File

@@ -1,35 +1,41 @@
<?php
/**
* Templates render the content of your pages.
* They contain the markup together with some control structures like loops or if-statements.
* The `$page` variable always refers to the currently active page.
* To fetch the content from each field we call the field name as a method on the `$page` object, e.g. `$page->title()`.
* 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
*/
/*
Templates render the content of your pages.
They contain the markup together with some control structures
like loops or if-statements. The `$page` variable always
refers to the currently active page.
To fetch the content from each field we call the field name as a
method on the `$page` object, e.g. `$page->title()`.
This template lists all all the subpages of the `phototography`
page with title and cover image.
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') ?>
<?php snippet('intro') ?>
<main>
<?php snippet('intro') ?>
<ul class="albums"<?= attr(['data-even' => $page->children()->listed()->isEven()], ' ') ?>>
<?php foreach ($page->children()->listed() as $album): ?>
<li>
<a href="<?= $album->url() ?>">
<figure>
<?php if ($cover = $album->cover()): ?>
<?= $cover->crop(800, 1000) ?>
<?php endif ?>
<figcaption><?= $album->title() ?></figcaption>
</figure>
</a>
</li>
<?php endforeach ?>
</ul>
</main>
<ul class="grid" style="--gutter: 1.5rem">
<?php foreach ($page->children()->listed() as $project): ?>
<li class="column" style="--columns: 3">
<a href="<?= $project->url() ?>">
<figure>
<span class="img" style="--w:4;--h:5">
<?= ($cover = $project->cover()) ? $cover->crop(400, 500) : null ?>
</span>
<figcaption class="img-caption">
<?= $project->title()->html() ?>
</figcaption>
</figure>
</a>
</li>
<?php endforeach ?>
</ul>
<?php snippet('footer') ?>