thanks for the hints! And yes, your way of “writing” php ist much more readable. Always learning ;o)
But I could not get my code running, even with the colon and the endif added. It just will not take the colon. Gave up.
You mentioned the hasDocuments() conditon. Checked the kirby reference against documents(). If I understood the reference right, there is no difference between both, except that hasDocuments() returns a boolean, whereas documents() returns the actual documents, which can have many other file types than just pdf.
Again many thanks for your help, code is working ;o)
That’s right, hasDocuments() checks if there are any files of type document (pdf, etc. $page->documents() | Kirby CMS) whereas $page->documents() returns all files of that type. However, if you check if $page->hasDocuments() that condition might return true if you have pdfs, text files and document types, while $page->documents()->filterBy('extension', 'pdf') could still be empty. In that case you would end up with a headline and an empty ul element.