Entries for month: December 2010

Break Every 3 Iterations in Loop

Here is something odd, yet useful.  In a loop break (or add diff class, whatever you want to do..) after every 3 iterations.  Could possibly be a cleaner way to do this....



<cfloop query="projects">
	<cfif currentrow MOD 3 eq 1>
        	<div class="subcolumns equalize">
        </cfif>
                             
        <div <cfif currentrow MOD 3 eq 1>class="c33l"<cfelseif currentrow MOD 3 eq 2>class="c33c"<cfelseif currentrow MOD 3 eq 0>class="c33r"</cfif>>
        	<a href="#event#project.detail&project_id=#project_id#">
                	<img src="/images/projects/thumbs/1.jpg" alt="##Replace Alt##" class="thumb" />
                </a>
        </div>
                             
        <cfif currentrow MOD 3 eq 0>
        	</div>
        </cfif>
 </cfloop>


Bookmark and Share

No Comments