This content has been marked as final. Show 4 replies
If you format your custom tag with tabs or leading spaces, these can get included when the custom tag displays. You will probably want to control everything with the <cfsetting enablecfoutputonly="Yes"> tag and <cfoutput> tags around your display.
Even though you don't want to, you get a lot more control over returning the value of the string, and then displaying it. That's why it is often recommended.
I have added a <cfprocessingdirective suppresswhitespace="yes"> around all the code in the customtag, but i still get a leading and trailing space, the enablecfoutputonly is also in place and i am outputting the string i want trimmed and all between <cfoutput>'s.
I have found something that solves this problem, but it makes no sense at all!
That is, if i put all the CFML tags on one line of code, instead of using a nicely readable markup, it doesn't output the spaces!!! But what has the placement of my serverside tags to do with this. It shouldn't matter at all! especially not when i'm already using supresswhitespace!
This is a known issue with coldfusion's whitespace handling. enablecfoutputonly does not ignore carriage returns and whitespace. You can turn on whitespace management in the ColdFusion administrator. You can/should also use <cfsilent> copiously. If you have a tag where leading/trailing whitespace is absolutely critical, the approach I've used is to build up a string for later display in the tag, e.g.
Thanks! Works fine since i use <cfsilent>