Hello,
I want to adapt this structure (Restaurant menu | Kirby CMS) for my project. I don’t know why I don’t start.
blueprints/pages/links.yml
title: Links
icon: 🍕
fields:
namepage:
label:
en: Real Page Name
fr: Nom de page
type: text
text:
label:
en: Intro
fr: Intro
type: textarea
size: normal
links_carolefredericks:
extends: fields/links
label: Carole Fredericks
links_musicwebsite:
extends: fields/links
label: Music Websites
links_tvshowwebsites:
extends: fields/links
label: TV show Websites
links_blogs:
extends: fields/links
label: Blogs
links_misc:
extends: fields/links
label: Misc
/site/blueprints/fields/links.yml
label: Category
type: structure
fields:
links_title:
label:
en: Title
fr: Titre
type: text
links_description:
label:
en: Description
fr: Description
type: textarea
links_url:
label: URL
type: url
url_lang:
label:
en: Lang
fr: Langue
type: checkboxes
options:
- English
- French
- Others
/controllers/links.php
<?php
return function () {
$categories = [
'Carole Fredericks',
'Music Websites',
'TV show Websites',
'Blogs',
'Misc'
];
return [
'categories' => $categories
];
};
templates/link.php
<?php snippet('header') ?>`
<main class="restaurant-menu">
<header class="intro">
<h1><?= $page->title() ?></h1>
<?php if ($page->intro()->isNotEmpty()): ?>
<div class="intro-text text">
<?= $page->intro()->kt() ?></p>
</div>
<?php endif ?>
</header>
<?php foreach ($categories as $category): ?>
<section class="dishes">
<h2><?= $category ?></h2>
<?php foreach ($page->$category()->toStructure() as $links_title): ?>
<article class="dish">
<h3 class="dish-name"><?= $links_title->links_title() ?></h3>
<p class="dish-description"><?= $links_title->links_description() ?></p>
<p class="dish-price">€ <?= $links_title->links_url() ?></p>
<p class="dish-price">€ <?= $links_title->url_lang() ?></p>
</article>
<?php endforeach ?>
</section>
<?php endforeach ?>
</main>
<?php snippet('footer') ?>