To pound or not to pound in ColdFusion

Most Cold Fusion developers overuse the # character. Here are a couple of rules that will help you decide when to “pound” your variables:

  1. #’s are never needed around variable names used in Cold Fusion tag attributes, unless they occur within an attribute string.
  2. #’s are always needed around variables that occur outside of (or in between pairs of) Cold Fusion tags. In other words, variables that occur within a block of text (e.g. SQL code between <CFQUERY> and </CFQUERY>, text in a <CFMAIL> body) must be surrounded by #’s. Similarly, variables with a string (text within double quotes) must be surrounded by #’s too.

And those are the only places to use them.


Possibly related:
  • No related posts


Tagged | Post a Comment