CFoutput查询循环,但仅每隔三个循环添加一次html



我正在想办法把我的接线盒排成一排,以使其合适。我遇到的问题是使用cfoutput查询的循环。我只需要每隔三圈就开始一排。这从来都不是一个固定的数字,直接从数据库中提取。我怎么能让<div class="row">出现在第一个循环中,然后跳过第二个和第三个循环,但在第四个循环中回来,然后跳过5个和第6个,然后继续?

<div class="wrapper wrapper-content animated fadeInRight">
      <cfoutput query="grab_contacts">
        <div class="row">
        <!-- Insert Loop Here -->
            <div class="col-lg-4">
                <div class="contact-box">
                    <a href="../profiles/profile.cfm?employee_number=#grab_contacts.employee_number#">
                    <div class="col-sm-4">
                        <div class="text-center">
                            <img alt="image" class="img-circle m-t-xs img-responsive" src="../images/#grab_contacts.picture#">
                            <cfif len(grab_contacts.phone_extension)>
                            <div class="m-t-xs font-bold">Extension #grab_contacts.phone_extension#</div>
                            </cfif>
                        </div>
                    </div>
                    <div class="col-sm-8">
                        <h4><strong>#grab_contacts.firstname# #grab_contacts.lastname#</strong></h4>
                        <h5>
                            <strong>#grab_contacts.position#</strong><br><br>
                            <i class="fa fa-map-marker"></i> #grab_contacts.department# Department<br>
                            MCTC #grab_contacts.branch# Branch<br>
                        </h5>
                    </div>
                    <div class="clearfix"></div>
                        </a>
                </div>
            </div>
            <!-- End Loop Here --></cfoutput>
          </div>
       </div>

行应如下所示:
1 2 3
4 5 6
7 8 9

编辑:仍有问题

<div class="wrapper wrapper-content animated fadeInRight">
      <cfoutput query="grab_contacts">
        <cfif CurrentRow mod 3 eq 1>
            <div class="row">
        </cfif>
        <!-- Insert Loop Here -->
            <div class="col-lg-4">
                <div class="contact-box">
                    <a href="../profiles/profile.cfm?employee_number=#grab_contacts.employee_number#">
                    <div class="col-sm-4">
                        <div class="text-center">
                            <img alt="image" class="img-circle m-t-xs img-responsive" src="../images/#grab_contacts.picture#">
                            <cfif len(grab_contacts.phone_extension)>
                            <div class="m-t-xs font-bold">Extension #grab_contacts.phone_extension#</div>
                            </cfif>
                        </div>
                    </div>
                    <div class="col-sm-8">
                        <h4><strong>#grab_contacts.firstname# #grab_contacts.lastname#</strong></h4>
                        <h5>
                            <strong>#grab_contacts.position#</strong><br><br>
                            <i class="fa fa-map-marker"></i> #grab_contacts.department# Department<br>
                            MCTC #grab_contacts.branch# Branch<br>
                        </h5>
                    </div>
                    <div class="clearfix"></div>
                        </a>
                </div>
            </div>
            <!-- End Loop Here -->
        <cfif CurrentRow mod 3 eq 1>
            </div>
        </cfif>
          </cfoutput>
       </div>

行现在的外观:
1
2 3 4
5 6 7
8 9

<cfif CurrentRow mod 3 eq 1>
    <div class="row">
</cfif>

然后

<cfif CurrentRow mod 3 eq 0 or CurrentRow eq grab_contacts.recordCount>
    </div>
</cfif>

最后也是。

相关内容

  • 没有找到相关文章

最新更新