On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Hi, I'm trying insert a bootstrap v4 column for every entry in a MIGX variable into a page. However, I need to have html inserted only on the every 3rd entry to create a new row and set of columns. This is what I have, but will not allow me to create multiple rows of 3 columns each. Is there a way to do this? Thanks!!!

    [[+_first:is=`0`:then=`<div class="row">`:else=``]]   <!-- Also need inserted every 4th -->
    	<div class="col text-center">
            <img src="[[++assets_url]]img/flame.png" class="" />
            <h2>[[+client_name]]</h2>
            <hr>
            <h3>[[+client_story]]</h3>
        </div>
    [[+_last:is=`1`:then=`<div>`:else=``]]  <!-- Also need inserted every 3rd -->

    This question has been answered by himurovi4. See the first response.

    [ed. note: ceramicmonster last edited this post 8 months ago.]
    • discuss.answer
      Anton Tarasov Reply #2, 8 months ago
      That's good,
      [[+_first:is=`0`:then=`<div class="row">`:else=``]] 
      [[+_last:is=`1`:then=`<div>`:else=``]] 
      

      PLUS between first and last conditions:
      [[+idx:mod=`3`:is=`0`:then=`</div>`]] <!--you should close previous block-->

      and after
      [[+idx:mod=`4`:is=`0`:then=`<div class="row">`]] <!--you should open new block-->
      <div class="col text-center">...</div>
        Anton Tarasov
        MODX Developer

        Email: contact@antontarasov.com
        Web: antontarasov.com
      • Quote from: himurovi4 at Nov 14, 2018, 10:29 AM
        That's good,
        [[+_first:is=`0`:then=`<div class="row">`:else=``]] 
        [[+_last:is=`1`:then=`<div>`:else=``]] 
        

        PLUS between first and last conditions:
        [[+idx:mod=`3`:is=`0`:then=`</div>`]] <!--you should close previous block-->

        and after
        [[+idx:mod=`4`:is=`0`:then=`<div class="row">`]] <!--you should open new block-->
        <div class="col text-center">...</div>
        </div></div>

        I'm a bit confused, sorry. Can you show me the complete code? Thank you!
        • Quote from: ceramicmonster at Nov 14, 2018, 07:07 PM
          Quote from: himurovi4 at Nov 14, 2018, 10:29 AM
          That's good,
          [[+_first:is=`0`:then=`<div class="row">`:else=``]] 
          [[+_last:is=`1`:then=`<div>`:else=``]] 
          

          PLUS between first and last conditions:
          [[+idx:mod=`3`:is=`0`:then=`</div>`]] <!--you should close previous block-->

          and after
          [[+idx:mod=`4`:is=`0`:then=`<div class="row">`]] <!--you should open new block-->
          <div class="col text-center">...</div>
          </div></div>

          I'm a bit confused, sorry. Can you show me the complete code? Thank you!
          Nevermind, I got it. THANKS!