0

I'm adding two div-wrappers around every 3 relationships. However, if the relationships count ends at 5, then I still need to add the ending div tags.

Here is the code -- where "IS_LAST" is what I seem to need to target, How do I target the last relationship called into the loop?

 {models}
      {if models:count == "1 || 4 || 7"}
        <div class="item  active" >
               <div class="row">
      {/if}

      <!-- other code in here-->

      {if models:count == "1 || 4 || 7" OR  models:count == IS_LAST}
            </div>
            </div>
      {/if}
    {/models}
1

Try

 {models}
  {if models:count == "1 || 4 || 7"}
    <div class="item  active" >
           <div class="row">
  {/if}

  <!-- other code in here-->

  {if models:count == "1 || 4 || 7" OR  models:count == models:total_results}
        </div>
        </div>
  {/if}
{/models}
| improve this answer | |
  • Ended up like this. Thanks.{if models:count == 3 || models:count == 6 || models:count == 9 || models:count == 12} </div></div> {/if} {if models:count == models:total_results } {if models:count != 3 || models:count != 6 || models:count != 9 || models:count != 12} </div></div> {/if} {/if} – JayB Feb 14 '14 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.