Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
An example of how to implement looping in a ColdFusion custom tag (
<!--- doLoop.cfm --->
<cf_loop iterations="10" index="i">
<cfoutput>[#i#]</cfoutput>Hello World<br />
<!--- loop.cfm --->
<cfif (THISTAG.ExecutionMode EQ "Start")>
<cfparam name="attributes.index" type="variablename">
<cfparam name="attributes.iterations" type="integer">
<cfset variables.index = 1>
<cfset caller[attributes.index] = variables.index>
<cfset variables.index = variables.index + 1>
<cfif variables.index gt attributes.iterations>
<cfexit method="exittag">
<cfset caller[attributes.index] = variables.index>
<cfexit method="loop">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment