Answers.Body: <p>See below for some twig code to get you started, I omitted the actual HTML output for the individual items to better keep the overview. </p>
  
  <p>Whats happening is, you get all (or a reasonable big amount amount) of your entries, and start looping over them. </p>
  
  <p>The first time, you open a div that will contain 6 items. Afterwards, each time the loop index can be divised by 6 (aka, 6 more items have been looped over) you close the container div &amp; open a new one. </p>
  
  <p>Than finally after the last iteration, you close the container div again. </p>
  
  <p>Making the 6 items hide or display you can do with Javascript. Let me know if you need extra pointers on that. </p>
  
  <pre><code>{% for entry in craft.entries.section('alumni').order('RAND()')}
      {% if loop.first %}
          &lt;div class="container-for-6-items"&gt;
      {% endif %}
  
      {# Build item output here #}
  
      {% if loop.index is divisible by(6) %}
          &lt;/div&gt;
          &lt;div class="container-for-6-items"&gt;
      {% endif %}
  
      {% if loop.last %}
          &lt;/div&gt;
      {% endif %}
  {% endfor %}
  </code></pre>
  
  <p>Info on <a href="https://twig.symfony.com/doc/2.x/tests/divisibleby.html" rel="nofollow noreferrer">divisible by</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-24T12:55:20.383Z
Answers.LastActivityDate: 2017-07-24T12:55:20.383Z
Answers.UserDisplayName: mrsmn
Body: <p>I want to get entries randomly every minutes like setTimeout in javascript. Like below If possible. </p>
  
  <pre><code>            setTimeout({ {% for entry in craft.entries.section('alumni').order('RAND()').limit(6).find() %}
              &lt;a class="main-home-list-item" href="#"&gt;
                  &lt;div class="main-home-list-item__body"&gt;
                      {% set asset = entry.profileImage.first() %} {% if asset | length %}
                      &lt;div class="img-container"&gt;
                          &lt;img src="{{asset.getUrl()}}" alt="{{asset.title}}" /&gt;
                      &lt;/div&gt;
                      {% else %}
                      &lt;div class="img-container"&gt;
                          &lt;img src="assets/avatar.png" /&gt;
                      &lt;/div&gt;
                      {% endif %}
                      &lt;h4&gt;
                                  {{ entry.title }} {{ entry.lastName }}
                              &lt;/h4&gt;
                      &lt;p class="small"&gt;
                          {{entry.graduateYear}}
                      &lt;/p&gt;
                  &lt;/div&gt;
              &lt;/a&gt;
              {% endfor %} }, 1000);
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-07-24T11:26:17.873Z
Comments.Text: Twig is pre rendered on the server so I'm not sure what you're trying to accomplish here? Do you want to show a new randomly chosen entry each minute?
Comments.UserDisplayName: mrsmn
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-07-24T11:36:46.620Z
Comments.Text: I want to get random entries from craft CP. like randomly showing images every minutes 6 at a time and looping through the others.
Comments.UserDisplayName: Yonas Hailu
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-07-24T12:04:39.180Z
Comments.Text: You'll have to output the html for all of them beforehand, in the order you choose, and than use javascript on the frontend to do the switching every minute. I'm en route at the moment, i'll try and whip the above into a proper answer when I get back.
Comments.UserDisplayName: mrsmn
Tags: <entries><craft3>
Title: get entries randomly every minutes?
ThreadText: # get entries randomly every minutes?
  
  (Asked by: username_0 on 2017-07-24)
  
  I want to get entries randomly every minutes like setTimeout in javascript. Like below If possible.
  
  ```
              setTimeout({ {% for entry in craft.entries.section('alumni').order('RAND()').limit(6).find() %}
              <a class="main-home-list-item" href="#">
                  <div class="main-home-list-item__body">
                      {% set asset = entry.profileImage.first() %} {% if asset | length %}
                      <div class="img-container">
                          <img src="{{asset.getUrl()}}" alt="{{asset.title}}" />
                      </div>
                      {% else %}
                      <div class="img-container">
                          <img src="assets/avatar.png" />
                      </div>
                      {% endif %}
                      <h4>
                                  {{ entry.title }} {{ entry.lastName }}
                              </h4>
                      <p class="small">
                          {{entry.graduateYear}}
                      </p>
                  </div>
              </a>
              {% endfor %} }, 1000);
  
  ```
  
  **Tags:** entries, craft3
  
  > **Comments:**
  > **username_1**: Twig is pre rendered on the server so I'm not sure what you're trying to accomplish here? Do you want to show a new randomly chosen entry each minute?  
  > **username_0**: I want to get random entries from craft CP. like randomly showing images every minutes 6 at a time and looping through the others.  
  > **username_1**: You'll have to output the html for all of them beforehand, in the order you choose, and than use javascript on the frontend to do the switching every minute. I'm en route at the moment, i'll try and whip the above into a proper answer when I get back.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-07-24. Score: 1
  
  See below for some twig code to get you started, I omitted the actual HTML output for the individual items to better keep the overview.
  
  Whats happening is, you get all (or a reasonable big amount amount) of your entries, and start looping over them.
  
  The first time, you open a div that will contain 6 items. Afterwards, each time the loop index can be divised by 6 (aka, 6 more items have been looped over) you close the container div & open a new one.
  
  Than finally after the last iteration, you close the container div again.
  
  Making the 6 items hide or display you can do with Javascript. Let me know if you need extra pointers on that.
  
  ```
  {% for entry in craft.entries.section('alumni').order('RAND()')}
      {% if loop.first %}
          <div class="container-for-6-items">
      {% endif %}
  
      {# Build item output here #}
  
      {% if loop.index is divisible by(6) %}
          </div>
          <div class="container-for-6-items">
      {% endif %}
  
      {% if loop.last %}
          </div>
      {% endif %}
  {% endfor %}
  
  ```
  
  Info on [divisible by](https://twig.symfony.com/doc/2.x/tests/divisibleby.html)
  
  
  ---
  
  