<p>There are a number of ways to organize this using any combination of channels, structures, or categories — it's hard to give a recommendation on which way is better without knowing a little more about your site requirements. </p>

<p>Much will depend on things like:</p>

<ul>
<li>Will there be pages for both 'focus-areas' and 'initiatives' (or is one just used for organization)?</li>
<li>How the uri's should look? (i.e. 'focus-area/initiative/' or '/focus-areas/focus-area/' &amp; '/initiatives/initiative')</li>
<li>Are the relationships 'one-to-one' or 'many-to-one'?</li>
<li>Are the pages hierarchical and/or need a specific order defined?</li>
<li>Do the pages need entryTypes (because the layout and/or field requirements are unique for different pages)?</li>
<li>Do you need to generate site-navigation dynamically?</li>
</ul>

<p>Answering these questions will generally narrow down the options.</p>

<blockquote>
  <p>On each Focus Area page, I would like to show all Initiatives associated. Currently, for each Initiative, I have a Radio Button for each Focus Area it fits under.</p>
</blockquote>

<p>Typically, instead of a radioButton, you would create a relationship between any two channels/structures/categories using the <code>EntriesFieldType</code>. Once you have added the field to your focus-areas field layout, and added some related initiative entries, you can access the related initiatives using:</p>

<pre><code>{% for initiative in entry.initiatives %}
    &lt;li&gt;{{ initiative.title }}&lt;/li&gt;
{% endfor %}
</code></pre>

<p>or</p>

<pre><code>{% set initiatives = craft.entries.section('initiatives').relatedTo(entry) %}
{% for initiative in initiatives %}
    &lt;li&gt;{{ initiative.title }}&lt;/li&gt;
{% endfor %}
</code></pre>

<blockquote>
  <p>Would this be an appropriate use case for Categories?</p>
</blockquote>

<p>Maybe. If you want to conceptually consider them as categories (and categories fit all your other needs) then go for it. Otherwise the difference between categories and structures/channels is pretty minor (with the exception that categories do not support <code>entryTypes</code>).</p>

<blockquote>
  <p>Should I instead be using Entry Types for each Focus area?</p>
</blockquote>

<p>Maybe. <code>EntryTypes</code> are generally used when the field and/or layout requirements are unique in some way for the various entries. If the relationship between 'focus-areas' and 'initiatives' is one-to-one, and if you want the uri's to be 'focus-area/initiative' then a good option might be to combine the two structures together hierarchically and use <code>EntryTypes</code> to define the unique layout and fields requirements for each. In your template you would then check the entry's type and change the layout or include a sub-template.</p>

<pre><code>{% if entry.type = "initiative" %}
    {% include '_initiative.html' %}
{% endif %}
</code></pre>

<p>You can also use this approach site-wide to generate more dynamic site navigation, using craft's <code>nav</code> tag.</p>

CC BY-SA 3.0
2015-04-21T21:33:56.890Z
Thanks for the detailed answer! There's a focus areas page that lists all focus areas (3). There's an initiatives page that lists all initiatives. The URI's would look like '/focus-areas/sports' where I would say a little about sports, then pull in the sports initiatives (basketball etc). Focus Areas will have many initiatives, initiatives will have one focus area. No specific order is needed. I don't need to generate site-nav dynamically. Pages don't necessarily need entryTypes, all focus areas have one template, all initiatives have one template. Does this change your opinion at all?
Nick
CC BY-SA 3.0
2015-04-21T21:40:23.733Z
I don't need a URL like 'focus-areas/sports/basketball' I can just have a link to the basketball initiative. ('initiatives/basketball'). I was trying to separate the two of these, but looking back now and reading your answer, it almost seems like would make sense to combine these structures and have something like 'focus-areas/sports/basketball' though may be too late for this.
Nick
CC BY-SA 3.0
2015-04-21T22:24:25.573Z
None of your requirements would restrict you to using one solution over another. So it will mainly just come down to your preference, and how you want the CP to be organized (or how you see the site requirements changing over time). You could either combine them into one structure, if you want the initiatives nicely organized by focus area; or keep them separate, so that you don't have to deal with EntryTypes (which can add some minor complexity on the template side). I'm a fan of structures and entry types personally, but completely up to you.
Douglas McDonald
CC BY-SA 3.0
2015-04-21T21:23:56.873Z
2015-04-21T21:23:56.873Z
Douglas McDonald
<p>It sounds like Focus Areas could logically be a category and Initiatives a structure. <a href="https://craftcms.stackexchange.com/questions/8571/difference-between-categories-and-structures">They work very similarly with a few differences</a>. </p>

<p>Categories can use their own template and routing which is handy. You can also associate as many fields as you want with them just like Entries so you could flesh out a category page with headings, rich-text, matrix fields, etc.</p>

<p>When you are on a Focus Area page, Craft will automatically set a <code>category</code> variable to use when the URL matches the category route just like it sets an <code>entry</code> variable on entry URLs.</p>

<p>For example, on the <code>http://example.com/focus-area/sports</code> page, you could use <code>{{ category.title }}</code> that would give you the output <code>Sports</code>.</p>

<p>On a category page, you can use the <a href="http://buildwithcraft.com/docs/relations" rel="nofollow noreferrer">relatedTo parameter</a> to find Initiatives entries related to that category like this:</p>

<pre><code>{% set entries = craft.entries.section('initiatives').relatedTo(category) %}
{% for entry in entries %}
    {{entry.title}}
{% endfor %}
</code></pre>

<p>The other option that may make sense would be to make everything one nested Structure since it looks like Initiatives are exclusive to only one Focus Group.</p>

<ul>
<li>Sports

<ul>
<li>Basketball</li>
<li>Soccer</li>
</ul></li>
<li>Music

<ul>
<li>Trumpet</li>
</ul></li>
<li>Art

<ul>
<li>Painting</li>
</ul></li>
</ul>

<p>The potential drawback is that they're in the same section so they will use the same template routing. You could use Entry Types to manage different content for Focus Areas and Initiatives. You can't however force an Entry Type to be used like level 1 entries need to be entry type X and level 2 entry type Y. So someone could accidentally set up "Trumpet" as a Focus Area. </p>

<p>To get a list of Initiative from a Focus Group page you could use the <code>descendantOf</code> parameter.</p>

<pre><code>{% set entries = craft.entries.section('mySection').descendantOf(entry) %}
</code></pre>

<p>You could also the <code>type</code> parameter if you want to filter only certain Entry Types.</p>

<pre><code>{% set entries = craft.entries.section('mySection').type('initiatives').descendantOf(entry) %}
</code></pre>

CC BY-SA 3.0
2015-04-21T21:33:35.127Z
2015-04-21T21:33:35.127Z
2017-04-13T12:51:00.200Z
Alex Roper
<p>I have two structures: Focus Areas &amp; Initiatives.</p>

<p>I'd like to be able to associate the two of these structures. Here's a potential example:</p>

<p>Focus Areas:</p>

<ul>
<li>Sports</li>
<li>Music</li>
<li>Art</li>
</ul>

<p>Initiatives:</p>

<ul>
<li>Basketball</li>
<li>Soccer</li>
<li>Trumpet</li>
<li>Painting</li>
</ul>

<p>My organization has a number of Initiatives, each fit under a certain Focus Area.</p>

<p>On each Focus Area page, I would like to show all Initiatives associated. Currently, for each Initiative, I have a Radio Button for each Focus Area it fits under, but am having trouble thinking of how to further narrow down entries to show from the example below (which shows all initiatives):</p>

<pre><code>{% set entries = craft.entries.section('initiatives') %}
{% for entry in entries %}
    {{entry.title}}
{% endfor %}
</code></pre>

<p>Would this be an appropriate use case for Categories? Should I instead be using Entry Types for each Focus area?</p>

<entries><categories><structure>
Using Categories with Structures?
# Using Categories with Structures?

(Asked by: username_0 on 2015-04-21)

I have two structures: Focus Areas & Initiatives.
I'd like to be able to associate the two of these structures. Here's a potential example:
Focus Areas:

Sports
Music
Art

Initiatives:

Basketball
Soccer
Trumpet
Painting

My organization has a number of Initiatives, each fit under a certain Focus Area.
On each Focus Area page, I would like to show all Initiatives associated. Currently, for each Initiative, I have a Radio Button for each Focus Area it fits under, but am having trouble thinking of how to further narrow down entries to show from the example below (which shows all initiatives):
{% set entries = craft.entries.section('initiatives') %}
{% for entry in entries %}
    {{entry.title}}
{% endfor %}

Would this be an appropriate use case for Categories? Should I instead be using Entry Types for each Focus area?

**Tags:** entries, categories, structure

---

## 2 answers

### Answer by username_1 on 2015-04-21. Score: 3 | Accepted answer

There are a number of ways to organize this using any combination of channels, structures, or categories — it's hard to give a recommendation on which way is better without knowing a little more about your site requirements. 
Much will depend on things like:

Will there be pages for both 'focus-areas' and 'initiatives' (or is one just used for organization)?
How the uri's should look? (i.e. 'focus-area/initiative/' or '/focus-areas/focus-area/' & '/initiatives/initiative')
Are the relationships 'one-to-one' or 'many-to-one'?
Are the pages hierarchical and/or need a specific order defined?
Do the pages need entryTypes (because the layout and/or field requirements are unique for different pages)?
Do you need to generate site-navigation dynamically?

Answering these questions will generally narrow down the options.

On each Focus Area page, I would like to show all Initiatives associated. Currently, for each Initiative, I have a Radio Button for each Focus Area it fits under.

Typically, instead of a radioButton, you would create a relationship between any two channels/structures/categories using the EntriesFieldType. Once you have added the field to your focus-areas field layout, and added some related initiative entries, you can access the related initiatives using:
{% for initiative in entry.initiatives %}
    {{ initiative.title }}
{% endfor %}

or
{% set initiatives = craft.entries.section('initiatives').relatedTo(entry) %}
{% for initiative in initiatives %}
    {{ initiative.title }}
{% endfor %}


Would this be an appropriate use case for Categories?

Maybe. If you want to conceptually consider them as categories (and categories fit all your other needs) then go for it. Otherwise the difference between categories and structures/channels is pretty minor (with the exception that categories do not support entryTypes).

Should I instead be using Entry Types for each Focus area?

Maybe. EntryTypes are generally used when the field and/or layout requirements are unique in some way for the various entries. If the relationship between 'focus-areas' and 'initiatives' is one-to-one, and if you want the uri's to be 'focus-area/initiative' then a good option might be to combine the two structures together hierarchically and use EntryTypes to define the unique layout and fields requirements for each. In your template you would then check the entry's type and change the layout or include a sub-template.
{% if entry.type = "initiative" %}
    {% include '_initiative.html' %}
{% endif %}

You can also use this approach site-wide to generate more dynamic site navigation, using craft's nav tag.

> **Comments:**
> **username_0**: Thanks for the detailed answer! There's a focus areas page that lists all focus areas (3). There's an initiatives page that lists all initiatives. The URI's would look like '/focus-areas/sports' where I would say a little about sports, then pull in the sports initiatives (basketball etc). Focus Areas will have many initiatives, initiatives will have one focus area. No specific order is needed. I don't need to generate site-nav dynamically. Pages don't necessarily need entryTypes, all focus areas have one template, all initiatives have one template. Does this change your opinion at all?  
> **username_0**: I don't need a URL like 'focus-areas/sports/basketball' I can just have a link to the basketball initiative. ('initiatives/basketball'). I was trying to separate the two of these, but looking back now and reading your answer, it almost seems like would make sense to combine these structures and have something like 'focus-areas/sports/basketball' though may be too late for this.  
> **username_1**: None of your requirements would restrict you to using one solution over another. So it will mainly just come down to your preference, and how you want the CP to be organized (or how you see the site requirements changing over time). You could either combine them into one structure, if you want the initiatives nicely organized by focus area; or keep them separate, so that you don't have to deal with EntryTypes (which can add some minor complexity on the template side). I'm a fan of structures and entry types personally, but completely up to you.  

---

### Answer by username_2 on 2015-04-21. Score: 3

It sounds like Focus Areas could logically be a category and Initiatives a structure. They work very similarly with a few differences. 
Categories can use their own template and routing which is handy. You can also associate as many fields as you want with them just like Entries so you could flesh out a category page with headings, rich-text, matrix fields, etc.
When you are on a Focus Area page, Craft will automatically set a category variable to use when the URL matches the category route just like it sets an entry variable on entry URLs.
For example, on the http://example.com/focus-area/sports page, you could use {{ category.title }} that would give you the output Sports.
On a category page, you can use the relatedTo parameter to find Initiatives entries related to that category like this:
{% set entries = craft.entries.section('initiatives').relatedTo(category) %}
{% for entry in entries %}
    {{entry.title}}
{% endfor %}

The other option that may make sense would be to make everything one nested Structure since it looks like Initiatives are exclusive to only one Focus Group.

Sports


Basketball
Soccer

Music


Trumpet

Art


Painting


The potential drawback is that they're in the same section so they will use the same template routing. You could use Entry Types to manage different content for Focus Areas and Initiatives. You can't however force an Entry Type to be used like level 1 entries need to be entry type X and level 2 entry type Y. So someone could accidentally set up "Trumpet" as a Focus Area. 
To get a list of Initiative from a Focus Group page you could use the descendantOf parameter.
{% set entries = craft.entries.section('mySection').descendantOf(entry) %}

You could also the type parameter if you want to filter only certain Entry Types.
{% set entries = craft.entries.section('mySection').type('initiatives').descendantOf(entry) %}


---

