Answers.Body: <p>You need to find a way to get the right <a href="http://buildwithcraft.com/docs/templating/categorymodel" rel="nofollow">category model</a> to be able to receive all entries related to it.
  As you didn't set up our categories to have their own URL, you could find it using the relevant slug in your URL.
  Assuming that maches your categories slugs:</p>
  
  <pre><code>{% set categorySlug = craft.request.getLastSegment() %}
  {% set category = craft.categories.slug(categorySlug).first() %}
  
  {% if category %}
  
      {% set entries = craft.entries.relatedTo(category).limit(12) %}
      {% for entry in entries %}
          {{ entry.title }}
      {% endfor %}
  
  {% endif %}
  </code></pre>
  
  <p>Another, probably more elegant way would be to access a token set via a <a href="http://buildwithcraft.com/docs/routing#dynamic-routes" rel="nofollow">dynamic route</a>:</p>
  
  <pre><code>'regions/[SLUG]' =&gt; 'regions/_index'
  </code></pre>
  
  <p>You would now be able to access that token from a variable "slug":</p>
  
  <pre><code>{% set category = craft.categories.slug(slug).first() %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-07T23:21:27.820Z
Answers.Text: I have to sit with this for a while and try and wrap my mind around it.  New concepts to dig into here!
Answers.UserDisplayName: Jam
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-08T02:13:48.157Z
Answers.Text: ok so the top solution worked (lovely!) but I want to make sure I understood how or why.  So you said assuming the slug ( in my url ) matches the category slugs, this is relevant to  l .getlastSegment( ),?  By having matched categories/ landing page slugs, craft grabs the slug from the landing page and  sets the category to match the same named slug?  Then it gets related entries, loops, outputs and that happy feeling came across me?  Do I understand?  As more elegant solution, truth be told I don't know what a token set is.  Read about routes and ran away waving my hands.  TY for solution.
Answers.UserDisplayName: Jam
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-07T09:48:23.633Z
Answers.LastActivityDate: 2015-05-07T09:57:48.207Z
Answers.LastEditDate: 2015-05-07T09:57:48.207Z
Answers.UserDisplayName: carlcs
Body: <p>I have a site governed by a structure, including the homepage.  I have several "parental" landing pages with research areas (Atlantic, Pacific, Midwest etc ) intended to be the gateway to  the children entries in that area. (Boston, New York, DC etc).  </p>
  
  <p>I have categories (without urls) corresponding to the landing pages (Atlantic, Pacific, Midwest etc ) and would like to pull teasers from each child entry onto the landing page, so that the Atlantic landing page has teasers from the Atlantic children's entries pulled in via the category field, the Pacific landing page has teasers from the Pacific children's entries via category etc...)</p>
  
  <p>But I would like to do this in one template, rather than using multiple entry types.  </p>
  
  <p>I know I can get entries by an array of sections</p>
  
  <pre><code>{% for entry in craft.entries.section([atlantic, pacific, midwest]) %}
  </code></pre>
  
  <p>My mind cannot bend around how I could start at</p>
  
  <pre><code>{% for entry in craft.entries.section('pages') %}
  </code></pre>
  
  <p>and trek on from there to grab both the appropriate landing page and the categories that go with it dynamically.  Can I keep using arrays in both the page id's and the categories?  How would can I make a template know to grab the Atlantic and fill it with teasers from the Atlantic category?  Is it even possible?  </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-05-07T09:39:59.247Z
Comments.Text: How did you set up your landing pages? Singles? And you've set this up to load the same template, right?
Comments.UserDisplayName: carlcs
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-05-07T23:28:28.393Z
Comments.Text: no I have landing pages as part of the structure, too, with their own entry type.  And yes, same template . Thanks for the edit, BTW!
Comments.UserDisplayName: Jam
Tags: <entries><categories><structure><array>
Title: Getting Entry By Category for Landing Pages In A Structure
ThreadText: # Getting Entry By Category for Landing Pages In A Structure
  
  (Asked by: username_0 on 2015-05-07)
  
  I have a site governed by a structure, including the homepage. I have several "parental" landing pages with research areas (Atlantic, Pacific, Midwest etc ) intended to be the gateway to the children entries in that area. (Boston, New York, DC etc).
  
  I have categories (without urls) corresponding to the landing pages (Atlantic, Pacific, Midwest etc ) and would like to pull teasers from each child entry onto the landing page, so that the Atlantic landing page has teasers from the Atlantic children's entries pulled in via the category field, the Pacific landing page has teasers from the Pacific children's entries via category etc...)
  
  But I would like to do this in one template, rather than using multiple entry types.
  
  I know I can get entries by an array of sections
  
  ```
  {% for entry in craft.entries.section([atlantic, pacific, midwest]) %}
  
  ```
  
  My mind cannot bend around how I could start at
  
  ```
  {% for entry in craft.entries.section('pages') %}
  
  ```
  
  and trek on from there to grab both the appropriate landing page and the categories that go with it dynamically. Can I keep using arrays in both the page id's and the categories? How would can I make a template know to grab the Atlantic and fill it with teasers from the Atlantic category? Is it even possible?
  
  **Tags:** entries, categories, structure, array
  
  > **Comments:**
  > **username_1**: How did you set up your landing pages? Singles? And you've set this up to load the same template, right?  
  > **username_0**: no I have landing pages as part of the structure, too, with their own entry type.  And yes, same template . Thanks for the edit, BTW!  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-05-07. Score: 1 | Accepted answer
  
  You need to find a way to get the right [category model](http://buildwithcraft.com/docs/templating/categorymodel) to be able to receive all entries related to it.
  As you didn't set up our categories to have their own URL, you could find it using the relevant slug in your URL.
  Assuming that maches your categories slugs:
  
  ```
  {% set categorySlug = craft.request.getLastSegment() %}
  {% set category = craft.categories.slug(categorySlug).first() %}
  
  {% if category %}
  
      {% set entries = craft.entries.relatedTo(category).limit(12) %}
      {% for entry in entries %}
          {{ entry.title }}
      {% endfor %}
  
  {% endif %}
  
  ```
  
  Another, probably more elegant way would be to access a token set via a [dynamic route](http://buildwithcraft.com/docs/routing#dynamic-routes):
  
  ```
  'regions/[SLUG]' => 'regions/_index'
  
  ```
  
  You would now be able to access that token from a variable "slug":
  
  ```
  {% set category = craft.categories.slug(slug).first() %}
  
  ```
  
  > **Comments:**
  > **username_0**: I have to sit with this for a while and try and wrap my mind around it.  New concepts to dig into here!  
  > **username_0**: ok so the top solution worked (lovely!) but I want to make sure I understood how or why.  So you said assuming the slug ( in my url ) matches the category slugs, this is relevant to  l .getlastSegment( ),?  By having matched categories/ landing page slugs, craft grabs the slug from the landing page and  sets the category to match the same named slug?  Then it gets related entries, loops, outputs and that happy feeling came across me?  Do I understand?  As more elegant solution, truth be told I don't know what a token set is.  Read about routes and ran away waving my hands.  TY for solution.  
  
  ---
  
  