Hello, I have two questions for what I aim to do. I have an Actual page that shows a list events in the future. Those events comes from a panel field pages (like featured).
- My first trouble: Thoses featured events come from different template page. From a page lecon’s children and the others events comes from the contenucours page’s children offre’s children. I don’t know how to make a collection with two differents kind of page and depth of children. I did not find the reference in the kirby guide. Can you help me to understand how to make collection of those pages?
- My second trouble, I manage, at least, to make a collection for the events coming from the contenucours but then with this collection I failed to link back the featured events to the original page.
Thank you in advance for your help. I hope my question makes sense. I try to do my best to make it work, but my ability and understanding is still lacking some pieces…
<?php
$printedTitle = false;
$actualités = $data->actual()->toPages()->children();
$cours = $actualités->children()
?>
<?php if(!$printedTitle){?>
<h3><?= $data->title() ?></h3>
<?= h($data->text()->kt(), true) ?>
<article class=" paragraphe separateur">
<?php foreach($actualités as $actualité): ?>
<?php if(!$printedTitle){?>
<?php foreach($cours as $cour): ?>
<?php
$events = $cour->calendrier()->toStructure()->filterBy('date', '>=', date('Y-m-d'));
foreach($events as $event):
?>
<b><?= $event->date()->toDate('%A %e %B') ?></b><br>
<b><a href="<?= $actualité->parent() ?> "><?= $cour->title() ?></a></b>
<p>(<?= $actualité->parent()->title() ?>)</p>
<?php endforeach ?>
<?php endforeach ?>
<?php
$printedTitle = true;
}
?>
<?php endforeach ?>
</article>
<?php
$printedTitle = true;
}
?>