Answers.Body: <p>It looks a bit awkward, but to append items to an array you have to use Twig's <a href="http://twig.sensiolabs.org/doc/filters/merge.html" rel="nofollow"><code>merge</code></a> filter, merging the <code>feeds_array</code> with itself for each new item. Here's how I'd do it if you need different logic for each feed:</p>
  
  <pre><code>{% set feeds_array = [] %}
  
  {% for node in craft.feedme.feed(my_rssfeed) %}
      {% set feeds_array = feeds_array|merge([{ title: node.title }]) %}
  {% endfor %}
  
  {% for node in craft.feedme.feed(my_otherfeed) %}
      {% set feeds_array = feeds_array|merge([{ title: node.whateverField }]) %}
  {% endfor %}
  
  {% for post in feeds_array %}
      {{ post }}
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-21T13:15:32.967Z
Answers.Text: Great! That looks good :) I've managed to get it working somewhat. But I haven't gotten to the other feed yet, will use the merge filter when I do! Thanx!
Answers.UserDisplayName: Kenny Bones
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-21T12:36:08.820Z
Answers.LastActivityDate: 2015-10-21T12:36:08.820Z
Answers.UserDisplayName: Mike Pepper
Body: <p>I'm relatively new to Twig and PHP in general, so please don't shoot me just yet for asking stupid questions!</p>
  
  <p>Basically, I've got several feeds from RSS to Facebook and Twitter. And I need to merge all of these into a custom array so I can make sure all fields match. I'm gonna output all these later, after sorting them by their published date. </p>
  
  <p>But how do I get started with this thing? Create an empty array first, and then loop through the feeds and push each post into the array? How do I name the fields? This is what I have so far:</p>
  
  <pre><code>{% set feeds_array = [] %}
  
  {% set feed = craft.feedme.feed(my_rssfeed) %}
  
  {% for node in feed %}
      {% set feeds_array = {'title': node.title} %}
  {% endfor %}
  
  {% for post in feeds_array %}
      {{post}}
  {% endfor %}
  </code></pre>
  
  <p>Is this the way to go about this?</p>
  
Tags: <array><feed><plugin-feedme>
Title: Add several feeds into an array
ThreadText: # Add several feeds into an array
  
  (Asked by: username_0 on 2015-10-21)
  
  I'm relatively new to Twig and PHP in general, so please don't shoot me just yet for asking stupid questions!
  
  Basically, I've got several feeds from RSS to Facebook and Twitter. And I need to merge all of these into a custom array so I can make sure all fields match. I'm gonna output all these later, after sorting them by their published date.
  
  But how do I get started with this thing? Create an empty array first, and then loop through the feeds and push each post into the array? How do I name the fields? This is what I have so far:
  
  ```
  {% set feeds_array = [] %}
  
  {% set feed = craft.feedme.feed(my_rssfeed) %}
  
  {% for node in feed %}
      {% set feeds_array = {'title': node.title} %}
  {% endfor %}
  
  {% for post in feeds_array %}
      {{post}}
  {% endfor %}
  
  ```
  
  Is this the way to go about this?
  
  **Tags:** array, feed, plugin-feedme
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-10-21. Score: 2 | Accepted answer
  
  It looks a bit awkward, but to append items to an array you have to use Twig's [`merge`](http://twig.sensiolabs.org/doc/filters/merge.html) filter, merging the `feeds_array` with itself for each new item. Here's how I'd do it if you need different logic for each feed:
  
  ```
  {% set feeds_array = [] %}
  
  {% for node in craft.feedme.feed(my_rssfeed) %}
      {% set feeds_array = feeds_array|merge([{ title: node.title }]) %}
  {% endfor %}
  
  {% for node in craft.feedme.feed(my_otherfeed) %}
      {% set feeds_array = feeds_array|merge([{ title: node.whateverField }]) %}
  {% endfor %}
  
  {% for post in feeds_array %}
      {{ post }}
  {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: Great! That looks good :) I've managed to get it working somewhat. But I haven't gotten to the other feed yet, will use the merge filter when I do! Thanx!  
  
  ---
  
  