Using cfoutput tag inside loops

<cfoutput> tag has a problem while we make use of it inside loops. For example the code below will generate the output “Hello AjithAjithAjith”

<cfset varname = “Ajith”>

<cfloop from="1" to="3" index="i">

Hello <cfoutput>#varname#</cfoutput>

..some code goes here….

</cfloop>

I am not sure the reason behind this but have come across this in more than a few occasions. Just throw away the <cfoutput> tag covering the variable and this will work correctly.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: