7 Replies Latest reply on Aug 17, 2006 7:59 AM by ssawka

    forwardslash on cfset tags are gay, STOP IT

      people, there is not need to put a forward slash at the end of a cfset, or most coldfusion tags. this is not XML or XTHML.
        • 1. Re: forwardslash on cfset tags are gay, STOP IT
          paross1 Level 2
          Probably folks just attempting to exercise consistency and good coding practice. What are you, the trailing slash NAZI?

          Phil
          • 2. Re: forwardslash on cfset tags are gay, STOP IT
            Level 7
            There is no need, but very seldom is there any harm.

            Personally I find it easier to put the slash in, then always thinking.
            I'm now witting a line of XHTML, I'm now writing a line of CFML, I'm now
            writing a line of XHTML, I'm now writing a line of CFML that is
            generating a line of XHMTL, ad nausium.
            • 3. Re: forwardslash on cfset tags are gay, STOP IT
              Stressed_Simon Level 1
              Careful when doing this with custom tags as they may execute twice!
              • 4. Re: forwardslash on cfset tags are gay, STOP IT
                Level 7
                I said seldom are they a problem. There are exceptions, such as the
                custom tag situation.
                • 5. Re: forwardslash on cfset tags are gay, STOP IT
                  Level 7
                  > There is no need, but very seldom is there any harm.

                  Yes, but it doesn't make any *sense*, does it? As the OP so in delicately
                  put, CFML isn't XML-compliant, and *cannot* be XML-compliant, so what's the
                  point of peppring your code with meaningless slashes?


                  > Personally I find it easier to put the slash in, then always thinking.

                  Good god. Really? Do you not think that perhaps you might be in the wrong
                  line of work then?


                  > I'm now witting a line of XHTML, I'm now writing a line of CFML, I'm now

                  This could well be part of your problem (other than the reluctance to
                  think, that is). If you plan your code, then the bulk of your CFML will be
                  in one set of files, and the bbulk of your mark-up will be in another set
                  of files. The mix of the two should be minimal.

                  Just as a matter of interest, how do you cope with:
                  1) <cfif> / <cfelseif> / <cfelse> constructs;
                  2) the string concatenation operator;
                  3) < > operators in embedded JS and SQL statements;
                  4) [etc]

                  It's a fool's errand.

                  --
                  Adam
                  • 6. Re: forwardslash on cfset tags are gay, STOP IT
                    <newbie /> Level 1

                    I only put it in because if I only have my xml editor open and I want to make a
                    quick change to a coldfusion file, I'll open the .cfm in my xml editor.

                    But then as expected, my editor gives me warnings that the file is
                    not well-formed (need a closing tag or define it as an empty tag).

                    I think you are right.

                    For people who are only used to looking at CF code it looks really weird and
                    for people who are more used to looking at XML or XHTML code it looks
                    weird without it.

                    I'm new to programming and I'm not familiar with all of the do's and dont's but
                    I am glad that CF allows both!




                    • 7. Re: forwardslash on cfset tags are gay, STOP IT
                      ssawka Level 1
                      Although it is true that the backslash could be a problem, you should always include conditional logic in your custom tag to ensure that a single tag (not requiring an ending tag) is only executed once. This is particullary true if you are using the <cfmodule> tag, where you can run into problems if you need to have nested tags. for example if you have something like:

                      <cfmodule template="ct1.cfm"><cfmodule template="ct2.cfm"></cfmodule>

                      Without conditional logic and closing the inner <cfmodule> tag, ColdFusion has no way of knowing which tag the </cfmodule> is suppose to close.