Forum for discussing general topics related to Couch.
2 posts Page 1 of 1
Hi,
I have an accordion FAQ that I am trying to couchify, however I need a part of it to be an incrementing number, +1 for each new row created.
Code: Select all
                  <!-- Accordions wrapper -->
                     <div class="th-accordion">
                        <!-- Acc group #1 -->
                        <div class="acc-group">
                           <!-- Title group button acc #1 -->
                           <a data-toggle="collapse" data-target="#acc1" class="" aria-expanded="true">question 1<span class="acc-icon"></span></a>
                           <!--/ Title group button acc #1 -->

                           <!-- Acc #1 -->
                           <div id="acc1" class="collapse in" aria-expanded="true">
                              <!-- Content -->
                              <div class="content">
                                 <!-- Description -->
                                 <p>
                                    Answer 1
                                 </p>
                                 <!--/ Description -->
                              </div>
                              <!--/ Content -->
                           </div>
                           <!--/ Acc #1 -->
                        </div>
                        <!--/ Acc group #1 -->

                        <!-- Acc group #2 -->
                        <div class="acc-group">
                           <!-- Title group button acc #2 -->
                           <a data-toggle="collapse" data-target="#acc2" class="collapsed">question 2<span class="acc-icon"></span></a>
                           <!--/ Title group button acc #2 -->

                           <!-- Acc #2 -->
                           <div id="acc2" class="collapse ">
                              <!-- Content -->
                              <div class="content">
                                 <!-- Description -->
                                 <p>Answer 2
                                 </p>
                                 <!--/ Description -->
                              </div>
                              <!--/ Content -->
                           </div>
                           <!--/ Acc #2 -->
                        </div>
                        <!--/ Acc group #2 -->

                        <!-- Acc group #3 -->
                        <div class="acc-group">
                           <!-- Title group button acc #3 -->
                           <a data-toggle="collapse" data-target="#acc3" class="collapsed">Question 3<span class="acc-icon"></span></a>
                           <!--/ Title group button acc #3 -->

                           <!-- Acc #3 -->
                           <div id="acc3" class="collapse ">
                              <!-- Content -->
                              <div class="content">
                                 <!-- Description -->
                                 <p>
                                    Answer3
                                 </p>
                                 <!--/ Description -->
                              </div>
                              <!--/ Content -->
                           </div>
                           <!--/ Acc #3 -->
etc
etc

So I need
Code: Select all
"#acc2"
in the line
Code: Select all
<a data-toggle="collapse" data-target="#acc2" class="collapsed">

to increment by 1 for each row
Is this possible? If so how :)
Thanks
Hi,

Within the cms:show_repeatable loop, you'll find a variable named 'k_count' - this (by default) begins with '1' and gets incremented by 1 for every successive row. You can use it in your code fro what you mentioned e.g. as follows -
<a data-toggle="collapse" data-target="#acc<cms:show k_count />" class="collapsed">

Hope it helps.
2 posts Page 1 of 1
cron