• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

forwardslash on cfset tags are gay, STOP IT

Guest
Aug 16, 2006 Aug 16, 2006

Copy link to clipboard

Copied

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.
TOPICS
Advanced techniques

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Aug 16, 2006 Aug 16, 2006

Copy link to clipboard

Copied

Probably folks just attempting to exercise consistency and good coding practice. What are you, the trailing slash NAZI?

Phil

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 16, 2006 Aug 16, 2006

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 16, 2006 Aug 16, 2006

Copy link to clipboard

Copied

Careful when doing this with custom tags as they may execute twice!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 17, 2006 Aug 17, 2006

Copy link to clipboard

Copied

LATEST
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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 16, 2006 Aug 16, 2006

Copy link to clipboard

Copied

I said seldom are they a problem. There are exceptions, such as the
custom tag situation.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 17, 2006 Aug 17, 2006

Copy link to clipboard

Copied

> 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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 17, 2006 Aug 17, 2006

Copy link to clipboard

Copied


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!




Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation