Answers.Body: <p>Set it as a variable inside your loop and you can reuse it all you want.</p>
  
  <pre><code> {% for entry in craft.entries.section('yourSection') %}
      {% set loopIndex = loop.index %}
      &lt;li&gt;"rs-{{loopIndex}}" id="slide-{{loopIndex}}-layer-2"&lt;/li&gt;
   {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-02T08:59:34.490Z
Answers.LastActivityDate: 2016-10-03T19:01:33.143Z
Answers.LastEditDate: 2016-10-03T19:01:33.143Z
Answers.UserDisplayName: Jan_dh
Body: <p>I am working on a testimonial slider and each slide is wrapped in an <code>&lt;li&gt;</code> tag. The JS looks for a similar id number, one for each layer of the slide, in this case I need to change the 1 in the example below.</p>
  
  <p>Example:</p>
  
  <p>"rs-1"
  id="slide-1-layer-2" 
  id="slide-1-layer-3" </p>
  
  <p>I loop through the entries with a normal {% for %}{% endfor %} statement and I tried rendering the required number (1) with the {{ loop.index }} but I guess you can only use this once...</p>
  
  <p>Is there a method do this? Perhaps with Twig? </p>
  
  <p>If I am not clear this is what the result should be:</p>
  
  <pre><code>&lt;li&gt;"rs-1"
          id="slide-1-layer-2" 
          id="slide-1-layer-3" 
  &lt;/li&gt;
  &lt;li&gt;"rs-2"
          id="slide-2-layer-2" 
          id="slide-2-layer-3" 
  &lt;/li&gt;
  &lt;li&gt;"rs-3"
          id="slide-3-layer-2" 
          id="slide-3-layer-3" 
  &lt;/li&gt;
  </code></pre>
  
  <p>etc...</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-10-05T13:14:58.403Z
Comments.Text: Nutmeg, I think the answer below is correct or do you still have issues with something?
Comments.UserDisplayName: Jan_dh
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-10-05T21:21:39.763Z
Comments.Text: yes, thank you Jan! Next is to use this in a sum, but i am sure thats done with a Twig native tags
Comments.UserDisplayName: Nutmeg
Tags: <count>
Title: How to add a unique number for each reiteration and render it multiple times?
ThreadText: # How to add a unique number for each reiteration and render it multiple times?
  
  (Asked by: username_0 on 2016-10-02)
  
  I am working on a testimonial slider and each slide is wrapped in an `<li>` tag. The JS looks for a similar id number, one for each layer of the slide, in this case I need to change the 1 in the example below.
  
  Example:
  
  "rs-1"
  id="slide-1-layer-2"
  id="slide-1-layer-3"
  
  I loop through the entries with a normal {% for %}{% endfor %} statement and I tried rendering the required number (1) with the {{ loop.index }} but I guess you can only use this once...
  
  Is there a method do this? Perhaps with Twig?
  
  If I am not clear this is what the result should be:
  
  ```
  <li>"rs-1"
          id="slide-1-layer-2" 
          id="slide-1-layer-3" 
  </li>
  <li>"rs-2"
          id="slide-2-layer-2" 
          id="slide-2-layer-3" 
  </li>
  <li>"rs-3"
          id="slide-3-layer-2" 
          id="slide-3-layer-3" 
  </li>
  
  ```
  
  etc...
  
  **Tags:** count
  
  > **Comments:**
  > **username_1**: username_0, I think the answer below is correct or do you still have issues with something?  
  > **username_0**: yes, thank you Jan! Next is to use this in a sum, but i am sure thats done with a Twig native tags  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-10-02. Score: 6 | Accepted answer
  
  Set it as a variable inside your loop and you can reuse it all you want.
  
  ```
   {% for entry in craft.entries.section('yourSection') %}
      {% set loopIndex = loop.index %}
      <li>"rs-{{loopIndex}}" id="slide-{{loopIndex}}-layer-2"</li>
   {% endfor %}
  
  ```
  
  
  ---
  
  