It was probably stupid for me to attempt this, but I’m trying to wire up the concept illustrated here: https://getkirby.com/docs/reference/panel/samples/one-pager
But instead of using that as the primary page, I’m trying to set it up so I can create as many child pages as I want using the same approach. Basically a blog, with each entry page being broken up into parts like the One Pager example.
I implemented the following in my top level template:
<?php foreach ($page->children() as $part) : ?>
<?php snippet($part->intendedTemplate(), compact('part')) ?>
<?php endforeach ?>
But I can’t seem to access any of the fields in the actual Part templates.
This is the blueprint I’m using as my parent “One Pager” post:
sections:
parts:
headline: Parts
type: pages
empty: Add at least a project intro you noob.
status: all
info: "{{ project.intendedTemplate }}"
image: false
templates:
- project-intro
- project-summary
- project-screenshot
- project-text-row
- project-image-and-text
- project-left-image-and-text
- project-quote
And this is the blueprint for the project-intro Part:
title: Project Intro
icon: title
fields:
cover:
type: files
label: Hero Image
query: site.images
empty: No file selected yet.
multiple: false
uploads:
parent: site
heroSummary:
type: text
label: Project One-liner
In snippets/project-intro.php I have the following:
<project-head style="background: blue;">
<section class="intro">
<h3><?php echo $page->title(); ?></h3>
<h1><?php echo $page->heroSummary(); ?></h1>
</section>
</project-head>
heroSummary(); returns nothing. I’m assuming it’s because I can’t reference it by $page->, but I don’t know how to go “deeper” into the part templates to get that value.
Sorry for the novel.