<p>Your approach looks good to me. There are different ways you can make it happen:</p>

<p>If you set up your structure in the CP you can decide how many levels you want to allow for that structure. (By default the number of levels is not limited.) If you have entered at least one parent entry in your structure, you can assign child entries in two ways:</p>

<p>1 – When you create a new entry you can choose a parent for that entry.</p>

<p>2 – If you miss that step or you change your mind later, you can move your entries around in the structure entries list: Choose your structure under „Entries“, klick and hold the cross in front of the entry you want to move and then drag it to the desired location. (So it´s possible to move a child entry from one parent to another later on.)</p>

<p>As for the templates for this set up, you have different options as described here:
<a href="https://craftcms.stackexchange.com/questions/16249/how-to-load-a-different-template-for-parent-page">How to load a different template for parent page</a></p>

<p>Another possibly interesting solution would be „Entry types“. </p>

<p>If you find that your parent entries would also use different fields than your child entries it could make sense to define a second entry type for the children in that section (<a href="https://craftcms.com/docs/sections-and-entries" rel="nofollow noreferrer">https://craftcms.com/docs/sections-and-entries</a>). When you define the „child" entry type, you assign fields to that just like for the first (parent) entry type. If you now enter a new entry for the section you can choose between the entry types and then are presented with the different field sets.</p>

<p>Regarding the templates you can still use the first solution but now you could change the layouts based on entry types as well:
In your template for single entries you could something like this</p>

<pre><code>{% if entry.type == "child" %}
    {% include "sectionTemplateFolder/_types/child" %}
{% else %}
    {% include "sectionTemplateFolder/_types/parent" %}
{% endif %}
</code></pre>

<p>(This example assumes that you have an actual entry type called „child“, replace the „child“ in the if statement with your desired name.)</p>

<p>An elegant solution how to change layouts between several entry types is given here:
<a href="https://craftcms.com/support/entry-type-templates" rel="nofollow noreferrer">https://craftcms.com/support/entry-type-templates</a></p>

<p>Whatever approach you take you do not need to structure your templates like your entries. Within the Craft templates folder, the templates can live where it makes the most sense to you. For the entry-type example it could be</p>

<ul>
<li>sectionName (folder)

<ul>
<li>index.html (for listing)</li>
<li>_entry.html (for the single entries)</li>
<li>_types (folder)

<ul>
<li>child.html</li>
<li>parent.html</li>
</ul></li>
</ul></li>
</ul>

<p>Hope this helps?</p>

CC BY-SA 3.0
2016-12-03T12:19:29.553Z
2016-12-04T17:40:33.503Z
2017-04-13T12:51:00.303Z
Wolfram Gehring
<p>i am trying to figure out the right way to display elements on a page.
Its about a website for a fashion designer. There will be parent elements like :</p>

<ul>
<li>Parent X</li>
<li>Parent Y </li>
</ul>

<p>both of those elements use the same template and i used structure for it. i figured structure is the right choice because of the ability to sort them in the panel etc.</p>

<p>It should be possible to add child elements to the parents like </p>

<ul>
<li>Parent X

<ul>
<li>Item a</li>
<li>Item b </li>
</ul></li>
<li>Parent Y

<ul>
<li>Item c</li>
</ul></li>
</ul>

<p>etc..</p>

<p>those elements are using a different template:</p>

<p>Like 
- ParentTemplate/</p>

<p>and 
- ParentTemplate/ItemTemplate/</p>

<p>how can i structure them in the craft panel without making them a new structure, because the new structure isnt related to parents then anymore , what they have to be ... ot is it the wrong approach here ?</p>

<p>thanks a lot guys </p>

<entries><structure><children><parents>
How to manage different templates for a structure
# How to manage different templates for a structure

(Asked by: username_0 on 2016-12-03)

i am trying to figure out the right way to display elements on a page.
Its about a website for a fashion designer. There will be parent elements like :

* Parent X
* Parent Y

both of those elements use the same template and i used structure for it. i figured structure is the right choice because of the ability to sort them in the panel etc.

It should be possible to add child elements to the parents like

* Parent X
  + Item a
  + Item b
* Parent Y
  + Item c

etc..

those elements are using a different template:

Like
- ParentTemplate/

and
- ParentTemplate/ItemTemplate/

how can i structure them in the craft panel without making them a new structure, because the new structure isnt related to parents then anymore , what they have to be ... ot is it the wrong approach here ?

thanks a lot guys

**Tags:** entries, structure, children, parents


---

## 1 answers

### Answer by username_1 on 2016-12-03. Score: 4 | Accepted answer

Your approach looks good to me. There are different ways you can make it happen:
If you set up your structure in the CP you can decide how many levels you want to allow for that structure. (By default the number of levels is not limited.) If you have entered at least one parent entry in your structure, you can assign child entries in two ways:
1 – When you create a new entry you can choose a parent for that entry.
2 – If you miss that step or you change your mind later, you can move your entries around in the structure entries list: Choose your structure under „Entries“, klick and hold the cross in front of the entry you want to move and then drag it to the desired location. (So it´s possible to move a child entry from one parent to another later on.)
As for the templates for this set up, you have different options as described here:
How to load a different template for parent page
Another possibly interesting solution would be „Entry types“. 
If you find that your parent entries would also use different fields than your child entries it could make sense to define a second entry type for the children in that section (https://craftcms.com/docs/sections-and-entries). When you define the „child" entry type, you assign fields to that just like for the first (parent) entry type. If you now enter a new entry for the section you can choose between the entry types and then are presented with the different field sets.
Regarding the templates you can still use the first solution but now you could change the layouts based on entry types as well:
In your template for single entries you could something like this
{% if entry.type == "child" %}
    {% include "sectionTemplateFolder/_types/child" %}
{% else %}
    {% include "sectionTemplateFolder/_types/parent" %}
{% endif %}

(This example assumes that you have an actual entry type called „child“, replace the „child“ in the if statement with your desired name.)
An elegant solution how to change layouts between several entry types is given here:
https://craftcms.com/support/entry-type-templates
Whatever approach you take you do not need to structure your templates like your entries. Within the Craft templates folder, the templates can live where it makes the most sense to you. For the entry-type example it could be

sectionName (folder)


index.html (for listing)
_entry.html (for the single entries)
_types (folder)


child.html
parent.html



Hope this helps?


---

