On 8/9/07, Dave Watts <[EMAIL PROTECTED]> wrote:
> You can output text from within a CFC instead of (or in addition to)
> returning a value.

I know you CAN, but whether you SHOULD is a different question.
Whatever your personal opinion is, it's still a "weirdness" that has
to be dealt with.

I generally prefer this approach:

<cfcomponent>
<cffunction ... output="false" returntype="string">
<cfset var result = "" />
<cfsavecontent variable="result">
  ... stuff to output ...
</cfsavecontent>
<cfreturn result />
</cffunction>
</cfcomponent>

That way you can do either of these:

<cfoutput>#cfc.method()#</cfoutput>
<cfset output = cfc.method() />

If you output directly, then you can't do the latter, then the two
lines are semantically identical (the write to the output) and
`output` will be empty/null.  That's a drastically different set of
circumstances to "typical" CFC usage, which in my mind, makes it a Bad
Thing.

cheers,
barneyb

-- 
Barney Boisvert
[EMAIL PROTECTED]
http://www.barneyb.com/

Got Gmail? I have 100 invites.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade to ColdFusion 8 and integrate with Adobe Flex
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:285853
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to