Answers.Body: <p>Can't you fetch all the blocks with <code>block.topicTeaserItems.all()</code></p>
  
  <pre><code>{% include 'modules/module-squareteaser/_module-squareteaser' with {
    squareTeasers: block.topicTeaserItems.all()
  } %}
  </code></pre>
  
  <p>And then you display the headlines with <code>item.entryTopicHeadline</code></p>
  
  <pre><code>&lt;div class="squareteaser__wrapper _parent-3-child"&gt;
    {% for item in squareTeasers %}
      {% include 'modules/module-squareteaser/_module-squareteaser-item' with {
        headline: item.entryTopicHeadline
      } %}
    {% endfor %}
  &lt;/div&gt;
  </code></pre>
  
  <p>A simplified version would look like</p>
  
  <pre><code>&lt;div class="squareteaser__wrapper _parent-3-child"&gt;
      {% for item in block.topicTeaserItems.all() %}
          {{ item.entryTopicHeadline }}
      {% endfor %}
  &lt;/div&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-03T14:30:31.370Z
Answers.Text: Sure i could do it with "item.entryTopicHeadline". But i am using the "_module-squareteaser.twig" for multiple includes at different places on the website. So thats why i wanna go with just "squareteaserHeadline", Thought its somehow possible.
Answers.UserDisplayName: Mvrcel Boer
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-03T14:33:55.947Z
Answers.Text: You would have to create a new array of headlines by looping through all blocks in your `_overview-topicTeaser.twig`
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-03T15:03:32.090Z
Answers.Text: And how i do this? :)
Answers.UserDisplayName: Mvrcel Boer
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-03T15:05:25.387Z
Answers.Text: This would be a new question, but there are plenty examples how to create an array in twig. https://twig.symfony.com/doc/2.x/filters/merge.html
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-03T13:47:47.140Z
Answers.LastActivityDate: 2018-05-03T14:13:06.397Z
Answers.LastEditDate: 2018-05-03T14:13:06.397Z
Answers.UserDisplayName: Robin Schambach
Body: <p>So my 1. file is &quot;_overview-topicTeaser.twig&quot; which is within a matrix:</p>
  <pre><code>{% include 'modules/module-squareteaser/_module-squareteaser' with {
    squareTeasers: block.topicTeaserItems.all(),
    squareteaserHeadline: block.topicTeaserItems.one().entryTopicHeadline
  } %}
  </code></pre>
  <p>And my 2. file is &quot;_module-squareteaser.twig&quot;:</p>
  <blockquote>
  
  <pre><code>    &lt;div class=&quot;squareteaser__wrapper _parent-3-child&quot;&gt;
        {% for item in squareTeasers %}
  
          {% include 'modules/module-squareteaser/_module-squareteaser-item' with {
            headline: squareteaserHeadline
          } %}
  
        {% endfor %}
      &lt;/div&gt;
  </code></pre>
  </blockquote>
  <p>So i am looping in the 2. file the file &quot;_module-squareteaser-item.twg&quot; and want to put out the &quot;squareteaserHeadline&quot; in the frontend. But it always gives me the same headline from my first teaser in the loop, makes sense to me cause i am using the &quot;one()&quot; when i include the variable &quot;squareteaserHeadline&quot; in the first file.  But if i delete the &quot;one()&quot; i get nothing... so how do i get all teasers whith their own headline?</p>
  <p><a href="https://i.sstatic.net/969BO.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/969BO.png" alt="enter image description here" /></a></p>
  
Tags: <craft3><loop><include><plugin-supertable>
Title: Get the variables of a loop from an include file
ThreadText: # Get the variables of a loop from an include file
  
  (Asked by: username_0 on 2018-05-03)
  
  So my 1. file is "\_overview-topicTeaser.twig" which is within a matrix:
  
  ```
  {% include 'modules/module-squareteaser/_module-squareteaser' with {
    squareTeasers: block.topicTeaserItems.all(),
    squareteaserHeadline: block.topicTeaserItems.one().entryTopicHeadline
  } %}
  
  ```
  
  And my 2. file is "\_module-squareteaser.twig":
  
  > ```
  >     <div class="squareteaser__wrapper _parent-3-child">
  >       {% for item in squareTeasers %}
  >
  >         {% include 'modules/module-squareteaser/_module-squareteaser-item' with {
  >           headline: squareteaserHeadline
  >         } %}
  >
  >       {% endfor %}
  >     </div>
  >
  > ```
  
  So i am looping in the 2. file the file "\_module-squareteaser-item.twg" and want to put out the "squareteaserHeadline" in the frontend. But it always gives me the same headline from my first teaser in the loop, makes sense to me cause i am using the "one()" when i include the variable "squareteaserHeadline" in the first file. But if i delete the "one()" i get nothing... so how do i get all teasers whith their own headline?
  
  [![enter image description here](https://i.sstatic.net/969BO.png)](https://i.sstatic.net/969BO.png)
  
  **Tags:** craft3, loop, include, plugin-supertable
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-05-03. Score: 1
  
  Can't you fetch all the blocks with `block.topicTeaserItems.all()`
  
  ```
  {% include 'modules/module-squareteaser/_module-squareteaser' with {
    squareTeasers: block.topicTeaserItems.all()
  } %}
  
  ```
  
  And then you display the headlines with `item.entryTopicHeadline`
  
  ```
  <div class="squareteaser__wrapper _parent-3-child">
    {% for item in squareTeasers %}
      {% include 'modules/module-squareteaser/_module-squareteaser-item' with {
        headline: item.entryTopicHeadline
      } %}
    {% endfor %}
  </div>
  
  ```
  
  A simplified version would look like
  
  ```
  <div class="squareteaser__wrapper _parent-3-child">
      {% for item in block.topicTeaserItems.all() %}
          {{ item.entryTopicHeadline }}
      {% endfor %}
  </div>
  
  ```
  
  > **Comments:**
  > **username_0**: Sure i could do it with "item.entryTopicHeadline". But i am using the "_module-squareteaser.twig" for multiple includes at different places on the website. So thats why i wanna go with just "squareteaserHeadline", Thought its somehow possible.  
  > **username_1**: You would have to create a new array of headlines by looping through all blocks in your `_overview-topicTeaser.twig`  
  > **username_0**: And how i do this? :)  
  > **username_1**: This would be a new question, but there are plenty examples how to create an array in twig. https://twig.symfony.com/doc/2.x/filters/merge.html  
  
  ---
  
  