ubuntu:latest ist inzwischen 26.04 mit PHP 8.5, das Kirby 4.6 nicht unterstuetzt. 24.04 liefert php8.3 8.3.6-0ubuntu0.24.04.13 mit dem Fix fuer CVE-2026-109618/-109619. Image neu bauen mit --pull. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
33 lines
967 B
PHP
33 lines
967 B
PHP
<?php
|
|
/**
|
|
* Controllers allow you to separate the logic of your templates from your markup.
|
|
* This is especially useful for complex logic, but also in general to keep your templates clean.
|
|
*
|
|
* In this example, we handle tag filtering and paginating notes in the controller,
|
|
* before we pass the currently active tag and the notes to the template.
|
|
*
|
|
* More about controllers:
|
|
* https://getkirby.com/docs/guide/templates/controllers
|
|
*/
|
|
return function ($page) {
|
|
|
|
/**
|
|
* We use the collection helper to fetch the notes collection defined in `/site/collections/notes.php`
|
|
*
|
|
* More about collections:
|
|
* https://getkirby.com/docs/guide/templates/collections
|
|
*/
|
|
$notes = collection('notes');
|
|
|
|
$tag = param('tag');
|
|
if (empty($tag) === false) {
|
|
$notes = $notes->filterBy('tags', $tag, ',');
|
|
}
|
|
|
|
return [
|
|
'tag' => $tag,
|
|
'notes' => $notes->paginate(6)
|
|
];
|
|
|
|
};
|