View comments | RSS feed
Contents > Developing ColdFusion MX Applications > Elements of CFML > Comments PreviousNext

Comments

ColdFusion comments have a similar format to HTML comments. However, they use three dash characters instead of two; for example:

<!--- This is a ColdFusion Comment. Browsers do not receive it. --->

The ColdFusion server removes all ColdFusion comments from the page before returning it to the web server. As a result, the page that a user browser receives does not include the comment, and users cannot see it even if they view the page source.

You can embed CFML comments in begin tags (not just tag bodies), functions calls, and variable text in pound signs. ColdFusion ignores the text in comments such as the following:

<cfset MyVar = var1 <!--- & var2 --->>
<cfoutput>#Dateformat(now() <!---, "dddd, mmmm yyyy" --->)#</cfoutput> 

This technique can be useful if you want to temporarily comment out parts of expressions or optional attributes or arguments.

Note: You cannot embed comments inside a tag name or function name, such as <cf_My<!--- New --->CustomTag>. You also cannot embed comments inside strings, as in the following example: IsDefined("My<!--- New --->Variable").


Contents > Developing ColdFusion MX Applications > Elements of CFML > Comments PreviousNext

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


axcfalr';ql said on Mar 27, 2004 at 10:46 PM :
ColdFusion now supports nested comments!!!
That is, if you have code containing comments you can now use a single comment to comment out the entire block, both code and existing comments.
The following is valid on MX 6.1:
<!--- BEFORE NESTED <!--- NESTED ---> AFTER NESTED --->
Is this new is MX 6.1? Prior versions would have closed the first "<!---" upon the first occurence of the string "--->" returning to the browser everything that followed, i.e. "AFTER NESTED --->"

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/elemen25.htm