Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
JorritJ #1
Bug(?) CFMX return value functions
Hi,
I think I have found some sort of bug when you directly output the returned
value in a function. ColdFusion seems to insert a whitespace before the
returned value to a string.
Here's an example:
The first image is broken because the image adds a whitespace between
"159x120/" and the image name. Setting it to a variable first seems to work.
Any idea's?
<cffunction name="fnReturnImage">
<cfreturn "159x120_box_cfmx7">
</cffunction>
<cfoutput>
Direct output: <br>
<img
src="http://www.macromedia.com/images/shared/product_boxes/159x120/#fnReturnImag
e()#.gif">
<cfset imageSrc = fnReturnImage()>
Set to a var first: <br>
<img
src="http://www.macromedia.com/images/shared/product_boxes/159x120/#imageSrc#.gi
f">
</cfoutput>
JorritJ Guest
-
PL/pgSQL functions and RETURN NEXT
Here's an example that I butchered to cut it down to size that should illustrate what you need to do (basically use a LOOP construct) CREATE TYPE... -
Functions that return RECORD type
Hi I come from a MS-SQL background and am trying to figure out what is wrong with the function below:... -
functions return by reference question
If I want a function to return by reference, I do this? function & myCoolFunction() { $queryObject = new queryObject(); return $queryObject; }... -
[PHP] functions/methods and what they should return
You want to break off things into as many functions and components as possible. The idea is that if you want to change the way tables are... -
functions/methods and what they should return
Hi people. I'm working on a large application right now (complete ecom store) and I'd like to get some feedback on something. Each product... -
Adam Cameron #2
Re: Bug(?) CFMX return value functions
It's well documented (on these and other forums, anyhow ;-), and "expected
behaviour" (that's not to say it's not *crap* expected behaviour).
Add output="false" to your <cffunction> tag.
--
Adam
Adam Cameron Guest
-
Stressed_Simon #3
Re: Bug(?) CFMX return value functions
Put output="false" in ths cffunction tag and it will fix it!
<cffunction name="fnReturnImage" output="false">
<cfreturn "159x120_box_cfmx7">
</cffunction>
<cfoutput>
Direct output: <br>
<img
src="http://www.macromedia.com/images/shared/product_boxes/159x120/#fnReturnImag
e()#.gif">
<cfset imageSrc = fnReturnImage()>
Set to a var first: <br>
<img
src="http://www.macromedia.com/images/shared/product_boxes/159x120/#imageSrc#.gi
f">
</cfoutput>
Stressed_Simon Guest
-
JorritJ #4
Re: Bug(?) CFMX return value functions
Argh! Yes it sounds logical if you think of it.
Why didn't I think of this! :(
The folowing code works as well (without the output="no" option). So it is
expected behavour!
<cffunction name="fnReturnImage3"><cfreturn "159x120_box_cfmx7"></cffunction>
JorritJ Guest



Reply With Quote

