Answers.Body: <p>How are the entries ordered (by date in a channel, manually in a structure or other?)</p>
  
  <p>Are you using the entries anywhere elsewhere at all?</p>
  
  <p>There are a couple of ways you could go, If the Galleries are related to the Updates, you could create a relationship from one to another using an entries field, and then just have the parent render the child in the same loop to different single page entry templates.</p>
  
  <p>Depending on how the URLs need to be, you could use two different entry types in the same channel or structure.  If you need different URL structure you could always use {type} in the 'Entry URL Format' setting and then use custom routes if needed.</p>
  
  <p>Hope this helps :)</p>
  
  <p>I don't think you need to get as complex with arrays or anything.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-03T04:10:27.880Z
Answers.LastActivityDate: 2015-06-03T04:10:27.880Z
Answers.UserDisplayName: Steve Adams
Answers.Body: <p>To list entries of two sections in alternating order, I would do this.</p>
  
  <p>Use the <a href="http://buildwithcraft.com/docs/templating/elementcriteriamodel#ids" rel="nofollow"><code>ids</code></a> method to get an array of entry IDs for both of your sections. Then combine those arrays of IDs by <a href="http://twig.sensiolabs.org/doc/tags/for.html" rel="nofollow">iterating over a sequence '0..x'</a>, and for each step pull one ID from each of the individual arrays with <a href="http://twig.sensiolabs.org/doc/filters/merge.html" rel="nofollow"><code>merge</code></a>. You can now use that array of IDs in a new ElementCriteriaModel to get the entries you're after.</p>
  
  <pre><code>{% set galleryEntriesIds = craft.entries.section('gallery').limit(null).ids() %}
  {% set updateEntriesIds = craft.entries.section('update').limit(null).ids() %}
  
  {% set mixedEntriesIds = [] %}
  
  {% for key in 0..50 %}
  
      {% if galleryEntriesIds[key] is defined %}
          {% set mixedEntriesIds = mixedEntriesIds|merge(galleryEntriesIds[key]) %}
      {% endif %}
  
      {% if updateEntriesIds[key] is defined %}
          {% set mixedEntriesIds = mixedEntriesIds|merge(updateEntriesIds[key]) %}
      {% endif %}
  
  {% endfor %}
  
  {% set mixedEntries = craft.entries.id(mixedEntriesIds).fixedOrder(true) %}
  </code></pre>
  
  <p>Use <a href="http://buildwithcraft.com/docs/templating/entrymodel#getSection" rel="nofollow"><code>getSection</code></a> to check which section an entry belongs to within your loops.</p>
  
  <pre><code>{% paginate mixedEntries as entriesOnPage %}
      {% for entry in entriesOnPage %}
  
          {% if entry.getSection().handle == 'gallery' %}
              ...
          {% else %}
              ...
          {% endif %}
  
      {% endfor %}
  {% endpaginate %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-04T00:04:39.270Z
Answers.LastActivityDate: 2015-06-04T07:19:13.537Z
Answers.LastEditDate: 2015-06-04T07:19:13.537Z
Answers.UserDisplayName: carlcs
Body: <p>On my homepage I have one entry that is constantly there. Below that entry I want to display 2 different types of entries in an alternate order (gallery, update, gallery, update...).</p>
  
  <p>Right now I have it so that I'm getting all the sections, setting it to a variable and looping through doing a entry.type check so it renders according to it's type. What would happen now is that it would display everything according to the posts' time.</p>
  
  <p>Thoughts? Ideas? </p>
  
  <p>Thanks.</p>
  
  <p>my code</p>
  
  <pre><code>{# story #}
   {% for entry in craft.entries.section('stories').limit(1) %}
      &lt;div class="row"&gt;
      &lt;div class="large-6 large-centered columns test"&gt;
      &lt;article&gt;
          &lt;h3&gt;&lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/h3&gt;
          &lt;p&gt;Posted on {{ entry.postDate.format('F d, Y') }}&lt;/p&gt;
          {{ entry.body.getPage(1) }}
          &lt;img src="{{ entry.mainFeaturedImage.first().url }}"&gt;
          &lt;p&gt;&lt;a href="{{ entry.url }}"&gt;Continue reading&lt;/a&gt;&lt;/p&gt;
      &lt;/article&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  {% endfor %}
  {# end of story #}
  
  {% set entry3 = craft.sections.getAllSections() %}  
  &lt;div id="next-entries"&gt;
  {% paginate craft.entries(entry3).limit(2) as entries %}
  {% for entry in entries %}
  {% if entry.type == 'carousels' %}
          &lt;div class="row"&gt;
              &lt;div class="large-12 large-centered columns"&gt;
                  &lt;article&gt;
                      &lt;h3&gt;&lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/h3&gt;
                      &lt;p&gt;Posted on {{ entry.postDate.format('F d, Y') }}&lt;/p&gt;
                      {# {{ entry.body.getPage(1) }} #}
                      &lt;div class="row"&gt;
                          &lt;div class="fade"&gt;
                      {% for block in entry.gallery.limit(3).find() %}
                      {% set asset = block.galleryImage.first() %}
                      {# {% set asset2 = block.galleryImage.nth(2) %} #}
                          &lt;img class="large-4 columns carousel-image" src="{{ asset.url }}"&gt;
  
                      {% endfor %}
                      &lt;/div&gt;
                  &lt;/div&gt;
                      &lt;p&gt;&lt;a href="{{ entry.url }}"&gt;Continue reading&lt;/a&gt;&lt;/p&gt;
                  &lt;/article&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  {% elseif entry.type == 'updates' %}
          &lt;div class="row"&gt;
              &lt;div class="large-6 large-centered columns"&gt;
                  &lt;article&gt;
                      &lt;h3&gt;&lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/h3&gt;
                      &lt;p&gt;Posted on {{ entry.postDate.format('F d, Y') }}&lt;/p&gt;
                      {{ entry.body.getPage(1) }}
                      &lt;img src="{{ entry.mainFeaturedImage.first().url }}"&gt;
                      &lt;p&gt;&lt;a href="{{ entry.url }}"&gt;Continue reading&lt;/a&gt;&lt;/p&gt;
                  &lt;/article&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  {% endif %}
  
  {% endfor %}
  {% endpaginate %}
  &lt;/div&gt;
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-05-31T14:39:43.720Z
Comments.Text: Could you post the code to how your currently doing this to avoid a duplicate solution :)
Comments.UserDisplayName: Alec Ritson
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-06-05T04:17:46.677Z
Comments.Text: @fishfillet still problems setting this up?
Comments.UserDisplayName: carlcs
Tags: <templating><entries><array><singles>
Title: How to render entries on a singles page in a specific pattern/order?
ThreadText: # How to render entries on a singles page in a specific pattern/order?
  
  (Asked by: username_0 on 2015-05-29)
  
  On my homepage I have one entry that is constantly there. Below that entry I want to display 2 different types of entries in an alternate order (gallery, update, gallery, update...).
  
  Right now I have it so that I'm getting all the sections, setting it to a variable and looping through doing a entry.type check so it renders according to it's type. What would happen now is that it would display everything according to the posts' time.
  
  Thoughts? Ideas?
  
  Thanks.
  
  my code
  
  ```
  {# story #}
   {% for entry in craft.entries.section('stories').limit(1) %}
      <div class="row">
      <div class="large-6 large-centered columns test">
      <article>
          <h3><a href="{{ entry.url }}">{{ entry.title }}</a></h3>
          <p>Posted on {{ entry.postDate.format('F d, Y') }}</p>
          {{ entry.body.getPage(1) }}
          <img src="{{ entry.mainFeaturedImage.first().url }}">
          <p><a href="{{ entry.url }}">Continue reading</a></p>
      </article>
  </div>
  </div>
  {% endfor %}
  {# end of story #}
  
  {% set entry3 = craft.sections.getAllSections() %}  
  <div id="next-entries">
  {% paginate craft.entries(entry3).limit(2) as entries %}
  {% for entry in entries %}
  {% if entry.type == 'carousels' %}
          <div class="row">
              <div class="large-12 large-centered columns">
                  <article>
                      <h3><a href="{{ entry.url }}">{{ entry.title }}</a></h3>
                      <p>Posted on {{ entry.postDate.format('F d, Y') }}</p>
                      {# {{ entry.body.getPage(1) }} #}
                      <div class="row">
                          <div class="fade">
                      {% for block in entry.gallery.limit(3).find() %}
                      {% set asset = block.galleryImage.first() %}
                      {# {% set asset2 = block.galleryImage.nth(2) %} #}
                          <img class="large-4 columns carousel-image" src="{{ asset.url }}">
  
                      {% endfor %}
                      </div>
                  </div>
                      <p><a href="{{ entry.url }}">Continue reading</a></p>
                  </article>
              </div>
          </div>
  {% elseif entry.type == 'updates' %}
          <div class="row">
              <div class="large-6 large-centered columns">
                  <article>
                      <h3><a href="{{ entry.url }}">{{ entry.title }}</a></h3>
                      <p>Posted on {{ entry.postDate.format('F d, Y') }}</p>
                      {{ entry.body.getPage(1) }}
                      <img src="{{ entry.mainFeaturedImage.first().url }}">
                      <p><a href="{{ entry.url }}">Continue reading</a></p>
                  </article>
              </div>
          </div>
  {% endif %}
  
  {% endfor %}
  {% endpaginate %}
  </div>
  
  ```
  
  **Tags:** templating, entries, array, singles
  
  > **Comments:**
  > **username_1**: Could you post the code to how your currently doing this to avoid a duplicate solution :)  
  > **username_2**: @username_0 still problems setting this up?  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2015-06-03. Score: 1
  
  How are the entries ordered (by date in a channel, manually in a structure or other?)
  
  Are you using the entries anywhere elsewhere at all?
  
  There are a couple of ways you could go, If the Galleries are related to the Updates, you could create a relationship from one to another using an entries field, and then just have the parent render the child in the same loop to different single page entry templates.
  
  Depending on how the URLs need to be, you could use two different entry types in the same channel or structure. If you need different URL structure you could always use {type} in the 'Entry URL Format' setting and then use custom routes if needed.
  
  Hope this helps :)
  
  I don't think you need to get as complex with arrays or anything.
  
  
  ---
  
  ### Answer by username_2 on 2015-06-04. Score: 1
  
  To list entries of two sections in alternating order, I would do this.
  
  Use the [`ids`](http://buildwithcraft.com/docs/templating/elementcriteriamodel#ids) method to get an array of entry IDs for both of your sections. Then combine those arrays of IDs by [iterating over a sequence '0..x'](http://twig.sensiolabs.org/doc/tags/for.html), and for each step pull one ID from each of the individual arrays with [`merge`](http://twig.sensiolabs.org/doc/filters/merge.html). You can now use that array of IDs in a new ElementCriteriaModel to get the entries you're after.
  
  ```
  {% set galleryEntriesIds = craft.entries.section('gallery').limit(null).ids() %}
  {% set updateEntriesIds = craft.entries.section('update').limit(null).ids() %}
  
  {% set mixedEntriesIds = [] %}
  
  {% for key in 0..50 %}
  
      {% if galleryEntriesIds[key] is defined %}
          {% set mixedEntriesIds = mixedEntriesIds|merge(galleryEntriesIds[key]) %}
      {% endif %}
  
      {% if updateEntriesIds[key] is defined %}
          {% set mixedEntriesIds = mixedEntriesIds|merge(updateEntriesIds[key]) %}
      {% endif %}
  
  {% endfor %}
  
  {% set mixedEntries = craft.entries.id(mixedEntriesIds).fixedOrder(true) %}
  
  ```
  
  Use [`getSection`](http://buildwithcraft.com/docs/templating/entrymodel#getSection) to check which section an entry belongs to within your loops.
  
  ```
  {% paginate mixedEntries as entriesOnPage %}
      {% for entry in entriesOnPage %}
  
          {% if entry.getSection().handle == 'gallery' %}
              ...
          {% else %}
              ...
          {% endif %}
  
      {% endfor %}
  {% endpaginate %}
  
  ```
  
  
  ---
  
  