This content has been marked as final. Show 7 replies
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.
Careful when doing this with custom tags as they may execute twice!
I said seldom are they a problem. There are exceptions, such as the
custom tag situation.
> 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;
It's a fool's errand.
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!
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.