It is certainly not a rule or a best practice to avoid directly
outputting from a CFC method. There are plenty of good reasons for doing
so and making blanket statements like yours only lead to confusion. For
example...

        WriteOutput(someCFC.someMethod());

Where someMethod() returns a string of HTML as you specified is
significantly more expensive than the following.

        someCFC.someMethod();

Where someMethod() directly outputs the HTML.

Matt Liotta
President & CEO
Montara Software, Inc.
http://www.montarasoftware.com/
888-408-0900 x901

> -----Original Message-----
> From: Raymond Camden [mailto:[EMAIL PROTECTED]]
> Sent: Monday, December 09, 2002 12:05 PM
> To: CF-Talk
> Subject: RE: CFC output
> 
> You should not directly output from the method, but should instead
> return a string with your output. If you are generating a complex
> result, which it sounds like you are, you would probably want to use
> cfsavecontent...
> 
> <cfsavecontent variable="result">
>       <b>#title#</b><br>
>       #foo#
> </cfsavecontent>
> 
> <cfreturn result>
> 
>
=======================================================================
> Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
> 
> Email    : [EMAIL PROTECTED]
> WWW      : www.camdenfamily.com/morpheus
> Yahoo IM : morpheus
> 
> "My ally is the Force, and a powerful ally it is." - Yoda
> 
> > -----Original Message-----
> > From: Cutter (CF_Talk) [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, December 09, 2002 10:46 AM
> > To: CF-Talk
> > Subject: CFC output
> >
> >
> > Does anyone have an example of a CFComponent with a function that
> > returns HTML formatted output. Trying to write a function
> > that performs
> > a query based on specific arguments then outputs a select box
> > based upon
> > the query results as well as some of the other arguments. I'd like
to
> > make it a web service but not sure if possible.
> > (Documentation for this
> > stuff seems kinda limited on MM, though I might just be
> > looking in the
> > wrong places.)
> >
> >
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

Reply via email to