Title: Message
I'm still not sure I agree -- given that in the end, you'll either do:
 
<cfoutput>#OutputHelloWorld()#</cfoutput>
 
[in which case, no problem returning the string instead of directly outputting]
 
Or, you'll do:
 
<cfscript>
    outputHelloWorld();
</cfscript>
 
[in which case, a quick writeOutput() should be fine]
 
To combine them together you might do something like this in your Application.cfm (or on the calling page):
 
 
<cfscript>
dataThing = createObject("component","dataThing").init();
displayThing = createObject("component","displayThing").init();
 
apiThing = createObject("component","apiThing").init(dataThing,displayThing);
 
application.api = apiThing;
</cfscript>
 
The developer can then use application.api (or whatever you call it) when they want to do their work -- in this way you can expose a very simple set of methods for them to use that utilizes the dataThing and the displayThing without the end-developer needing to worry about the complexities of how the interact.
 
 
 
 
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Brad Howerter
Sent: Friday, August 08, 2003 12:36 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [CFCDev] Display CFC (aka CFC for display purposes)

Your CFC will be easier to use if you have a method that does the cfoutput, too.  You can still have a method that returns a string, but go ahead and create another method to do the cfoutput, too.  Like in my example.
 
<cfcomponent>
  <cffunction name="OutputHelloWorld">
    <cfoutput>#helloWorld()#</cfoutput>
  </cffunction>
 
  <cffunction name="HelloWorld"> <!--- keeping the data separate from the display --->
     <cfreturn "Hello, World">
  </cffunction>
</cfcomponent>
 
How do you wrap them together?  That sounds neat.
-----Original Message-----
From: Nathan Dintenfass [mailto:[EMAIL PROTECTED]
Sent: Friday, August 08, 2003 1:30 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Display CFC (aka CFC for display purposes)

I would also just add that rather than actually outputting inside of a method, it would make your code much more flexible to just return a string that contains your HTML.  In that way you can do things like concatenate strings inside of CFSCRIPT and output them together later.  I haven't seen much reason why you wouldn't want to do it that way if you are going to generate HTML.
 
I'll also second that if you are going to do this it's probably worth splitting up the "data" and the "display" CFCs (even if you then wrap them together in a single facade).
 
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Raymond Camden
Sent: Friday, August 08, 2003 12:19 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Display CFC (aka CFC for display purposes)

Mind you I stressed that you shouldn't _forget_ the Flash issue. I'm more worried about the CFC beginner than most of us on this list. ;)
 
I'm working on a CFC now that uses a few methods that output. It's primarily to allow for a 'default' rendering of the application.
 
 

=======================================================================
Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
Member of Team Macromedia

Email    : [EMAIL PROTECTED]
Blog     : www.camdenfamily.com/morpheus/blog
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Samuel Neff
Sent: Friday, August 08, 2003 1:17 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Display CFC (aka CFC for display purposes)

As long as the CFC methods are purely display then the Flash Remoting issue doesn't exist--they can still access the business logic/data cfc which presumably the display cfc is using.
 
As long as the CFC is purely for display then I personally see no problem with using it.
 
I haven't read much about it, but since MachII is all CFC based, does it use CFC's for display or still CFM's?
 
Sam
 
 

----------------------------------------------
Blog:  http://www.rewindlife.com
Chart: http://www.blinex.com/products/charting
----------------------------------------------

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Raymond Camden
Sent: Friday, August 08, 2003 3:11 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Display CFC (aka CFC for display purposes)

Actually, there was a very good argument against this pre-RedSky. If you cached the CFC you would lose the ability to output.
 
Another reason to not output... and thiis just something to remember, not really an arguments against using output at all - but if you output instead of returning, Flash Remoting can't use the method. Again, it's not a big huge deal, but it's something you _should_ remember before using output.

Reply via email to