Forum
How can I create a template that can have many children?
Hi,
I'm trying to figure out how to create a template that can have many children?
Kind of like how a blog has posts that each post can have many comments.
I tried to nest a template inside another template but that doesnt work, any ideas how to do this?
Can you give an example of where you're trying to get to?
Ok,
So say I'm trying to create a listing of houses that up for sale, and in each of thoses listings I might have 1 or 2 estate agents I want to attach.
Now I could do this by creating a template called 'house' and have fields for agent_1_name, agent_1_url, agent_2_name, agent_2_url.
But that's a bit hacky.
How should I do this?
Could you make checkbox fields in the record for agent1, agent2, agent3, etc? Then you tick the box for whichever agents go with that house. You'd have a separate template to handle the agent display format, and on the house page have a condition that uses the ticked box results to display the agent(s).
Or maybe you could make a category set for agents, and then in the house record you'd just need one category field so all the agent names could go into that field. Then you loop through those names and add the agent details on the page.
I second Alan's suggestion of using categories - at least then there's a central group of Estate agents.
Furthermore, have a look at Runway - relationships between collections sounds perfect for this.
A collection of houses related to a collection of Estate agents - and if the website ends up displaying a lot of houses, Runway could be the better fit anyway.
Runway sounds like the way to go, thanks Duncan and thanks Alan for the checkbox idea, I'll try that out.