Hi everyone,
I’m creating a website in which I have a “Calendar” page. On this page, I’d like to display the different events that are in the child pages of “Productions” in a calendar that I’ve created myself. An “Event” page (child of the “Productions” page) contains events with 3 fields (date, url and availability).
What I’d like to do is search for all the events in the “Event” pages and sort them by date.
I can easily access the information on these pages, for example:
{% set prods = pages.find('/productions').children().published() %}
{% for event in prods %}
{{ event.url }}
{% endfor %}
But I can’t create a condition like:
if you find an event, in all the events, that happens on this date, then …
for example:
{% if event.header.dates.date|date("d.m.y") == " 10.09.24" %}
{% endif %}
How do I get my condition to pass through all the dates and choose the right one?
Thank you in advance for your help.
Edit: Here’s my blueprint:
form:
fields:
tabs:
fields:
content:
fields:
dates:
type: section
title: "Dates"
underline: true
fields:
header.dates:
type: list
label: "Add a date"
style: horizontal
fields:
.date:
type: datetime
label: "Date"
.url:
type: text
label: "Link to shop"
.available:
type: toggle
label: "Availabilty?"
highlight: 1
default: 1
options:
1: Available
0: No longer available
validate:
type: bool