First off I’m pretty new to Kirby, I’m still testing it out. Go easy on me.
So far I’m loving it, makes a refreshing change from WordPress
I have a question about repeated fields in Kirby, I’m not sure if I’m wording my searches properly (or this question), as I’m not getting any useful results. I am wanting to achieve something like what Advance Custom Fields’ Repeater Field can achieve in WordPress.
I’d like to create a page template the could have multiple ‘sections’ on the same page. The numbers of sections could change from page to page, and whats in these sections could also change. In this example, each section has a title, text and a image src.
Now I know could call a bunch of custom fields, like this for example…
Title1: The Title of the first section ---- Text1: The paragraph for my first section. ---- ImageSrc1: /content/2-test-sections/1-test-section/myfirstimage.jpg ---- Title2: The Title of the second section ---- Text2: The paragraph for my second section. ---- ImageSrc2: /content/2-test-sections/1-test-section/mysecondimage.jpg ---- ...etc...
But some pages might have, say 10 ‘sections’ so it seems stilly to have to create 10 “Titles:”. Also if I decide later to add an 11th section on a new page, I’d have to re-edit the template.
So my question is, is there some php that can count the number of times title: appears and create a new section for this, not dependant on a actual number?
Also say there are 3 sections, but the 3rd doesn’t have an image src, it would just ignore outputting the html for the image?
My php skills are pretty basic but I’m sure this should be easy to achieve, any help/links/advice would be very much appreciated.