1

I need to display a block from a matrix for the following week.

Basically the query I need to build is

{% for block in workshop.workshopSession.where(sessionDate > now).first() %}

I just can't quite get this to work and have been searching for a while. Perhaps I am just missing something obvious. There will be more than one entry with a date greater than "now" so I need to limit it to 1.

2

I think this should do it.

{% for block in workshop.workshopSession.sessionDate('>=' ~ now|date('Y-m-d')).limit(1) %}

If not you always can go with a "dirty" fix by just showing the {% loop.first %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.