RE: Suppressing whitespace from CFCs

2010-08-05 Thread DURETTE, STEVEN J (ATTASIAIT)

cfsilentYour non-output code here!/cfsilent

-Original Message-
From: Robert Harrison [mailto:rob...@austin-williams.com] 
Sent: Thursday, August 05, 2010 10:14 AM
To: cf-talk
Subject: Suppressing whitespace from CFCs


I've moved output function into CFC's; thus I'm using output=true. Only
problem is the CFC is outputting whitespace where all the logic is now. 

How can I suppress the white space in an output CFC?



Robert B. Harrison
Director of Interactive Services
Austin  Williams
125 Kennedy Drive, Suite 100 
Hauppauge NY 11788
P : 631.231.6600 Ext. 119 
F : 631.434.7022
http://www.austin-williams.com 

Great advertising can't be either/or.  It must be .

Plug in to our blog: AW Unplugged
http://www.austin-williams.com/unplugged


 

__ Information from ESET Smart Security, version of virus signature
database 5343 (20100805) __

The message was checked by ESET Smart Security.

http://www.eset.com
 



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336018
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Suppressing whitespace from CFCs

2010-08-05 Thread Michael Grant

There's a couple of ways.

cfsetting enablecfoutputonly=Yes/ (still outputs stuff within cfoutput
though)cfsetting enablecfoutputonly=No/
cfsilent/cfsilent
cfprocessingdirective suppresswhitespace=Yes/cfprocessingdirective




On Thu, Aug 5, 2010 at 10:13 AM, Robert Harrison rob...@austin-williams.com
 wrote:


 I've moved output function into CFC's; thus I'm using output=true. Only
 problem is the CFC is outputting whitespace where all the logic is now.

 How can I suppress the white space in an output CFC?



 Robert B. Harrison
 Director of Interactive Services
 Austin  Williams
 125 Kennedy Drive, Suite 100
 Hauppauge NY 11788
 P : 631.231.6600 Ext. 119
 F : 631.434.7022
 http://www.austin-williams.com

 Great advertising can't be either/or.  It must be .

 Plug in to our blog: AW Unplugged
 http://www.austin-williams.com/unplugged




 __ Information from ESET Smart Security, version of virus signature
 database 5343 (20100805) __

 The message was checked by ESET Smart Security.

 http://www.eset.com


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336019
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Suppressing whitespace from CFCs

2010-08-05 Thread Robert Harrison

cfsilentYour non-output code here!/cfsilent

That was the first thing I tried. It chokes on CFSILENT inside a Function.
Says I need a /cffuntion... which is of course actually there. 


Robert B. Harrison
Director of Interactive Services
Austin  Williams
125 Kennedy Drive, Suite 100 
Hauppauge NY 11788
P : 631.231.6600 Ext. 119 
F : 631.434.7022
http://www.austin-williams.com 

Great advertising can't be either/or.  It must be .

Plug in to our blog: AW Unplugged
http://www.austin-williams.com/unplugged



-Original Message-
From: DURETTE, STEVEN J (ATTASIAIT) [mailto:sd1...@att.com] 
Sent: Thursday, August 05, 2010 10:15 AM
To: cf-talk
Subject: RE: Suppressing whitespace from CFCs


cfsilentYour non-output code here!/cfsilent

-Original Message-
From: Robert Harrison [mailto:rob...@austin-williams.com] 
Sent: Thursday, August 05, 2010 10:14 AM
To: cf-talk
Subject: Suppressing whitespace from CFCs


I've moved output function into CFC's; thus I'm using output=true. Only
problem is the CFC is outputting whitespace where all the logic is now. 

How can I suppress the white space in an output CFC?



Robert B. Harrison
Director of Interactive Services
Austin  Williams
125 Kennedy Drive, Suite 100 
Hauppauge NY 11788
P : 631.231.6600 Ext. 119 
F : 631.434.7022
http://www.austin-williams.com 

Great advertising can't be either/or.  It must be .

Plug in to our blog: AW Unplugged
http://www.austin-williams.com/unplugged


 

__ Information from ESET Smart Security, version of virus signature
database 5343 (20100805) __

The message was checked by ESET Smart Security.

http://www.eset.com
 





~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336020
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Suppressing whitespace from CFCs

2010-08-05 Thread Larry Lyons

My first idea is that output=true is a bad idea exactly for the reasons you 
brought up - ie excessive white space.

That said, you could use a udf like htmlCompressFormat 
(http://www.cflib.org/index.cfm?event=page.udfbyidudfid=812) on your final 
output. That ought to eliminate the extra white space.

regards,
larry


cfsilentYour non-output code here!/cfsilent

That was the first thing I tried. It chokes on CFSILENT inside a Function.
Says I need a /cffuntion... which is of course actually there. 


Robert B. Harrison
Director of Interactive Services
Austin  Williams
125 Kennedy Drive, Suite 100 
Hauppauge NY 11788
P : 631.231.6600 Ext. 119 
F : 631.434.7022
http://www.austin-williams.com 

Great advertising can't be either/or.  It must be .

Plug in to our blog: AW Unplugged
http://www.austin-williams.com/unplugged



cfsilentYour non-output code here!/cfsilent

I've moved output function into CFC's; thus I'm using output=true. Only
problem is the CFC is outputting whitespace where all the logic is now. 

How can I suppress the white space in an output CFC?



Robert B. Harrison
Director of Interactive Services
Austin  Williams
125 Kennedy Drive, Suite 100 
Hauppauge NY 11788
P : 631.231.6600 Ext. 119 
F : 631.434.7022
http://www.austin-williams.com 

Great advertising can't be either/or.  It must be .

Plug in to our blog: AW Unplugged
http://www.austin-williams.com/unplugged


 

__ Information from ESET Smart Security, version of virus signature
database 5343 (20100805) __

The message was checked by ESET Smart Security.

http://www.eset.com

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336021
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Suppressing whitespace from CFCs

2010-08-05 Thread Robert Harrison

Apparently you cannot use CFSILENT or CFSETTING inside a function at all.
Using either of these tags in the function give me the following error:


The start tag must have a matching end tag. An explicit end tag can be
provided by adding /cffunction. If the body of the tag is empty, you can
use the shortcut cffunction .../


Robert B. Harrison
Director of Interactive Services
Austin  Williams
125 Kennedy Drive, Suite 100 
Hauppauge NY 11788
P : 631.231.6600 Ext. 119 
F : 631.434.7022
http://www.austin-williams.com 

Great advertising can't be either/or.  It must be .

Plug in to our blog: AW Unplugged
http://www.austin-williams.com/unplugged

 

__ Information from ESET Smart Security, version of virus signature
database 5343 (20100805) __

The message was checked by ESET Smart Security.

http://www.eset.com
 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336022
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Suppressing whitespace from CFCs

2010-08-05 Thread Michael Grant

Ya, sorry. I never use output=true unless I actually want the output.


On Thu, Aug 5, 2010 at 11:10 AM, Robert Harrison rob...@austin-williams.com
 wrote:


 Apparently you cannot use CFSILENT or CFSETTING inside a function at all.
 Using either of these tags in the function give me the following error:


 The start tag must have a matching end tag. An explicit end tag can be
 provided by adding /cffunction. If the body of the tag is empty, you can
 use the shortcut cffunction .../


 Robert B. Harrison
 Director of Interactive Services
 Austin  Williams
 125 Kennedy Drive, Suite 100
 Hauppauge NY 11788
 P : 631.231.6600 Ext. 119
 F : 631.434.7022
 http://www.austin-williams.com

 Great advertising can't be either/or.  It must be .

 Plug in to our blog: AW Unplugged
 http://www.austin-williams.com/unplugged



 __ Information from ESET Smart Security, version of virus signature
 database 5343 (20100805) __

 The message was checked by ESET Smart Security.

 http://www.eset.com


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336024
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Suppressing whitespace from CFCs

2010-08-05 Thread Mike Kear

I believe the following will work ---

cffunction name=functionname output=true
cfargument name=whatever 
cfset var whatever = arguments.whatever /

Logic stuff in here.

cfsavecontent variable=outputstuffhtmlhead/head etc . your ourput
stuff goes here./cfsavecontent

cfreturn outputstuff /
/cffunction


Then in your calling page you have :

cfset outputgenerator = createobject(component, outputgenerator).init()
/
cfset myoutput = outputgenerator.functionname( whatever ) /

cfoutput#myoutput#/cfoutput


This way you're not outputting code directly from the CFC,  only generating
a string of output tags, which you're going to use in the calling page. it's
a couple of years since i've done it, but if my memory is serving me right,
that's how i solved the problem for a complex XML output cfc application,
where white space was really causing problems.  You only have to limit the
white space in your CFC between the CFSAVECONTENT tags.


Cheers
Mike Kear
Windsor, NSW, Australia
Adobe Certified Advanced ColdFusion Developer
AFP Webworks
http://afpwebworks.com
ColdFusion 9 Enterprise, PHP, ASP, ASP.NET hosting from AUD$15/month


On Fri, Aug 6, 2010 at 1:10 AM, Robert Harrison
rob...@austin-williams.comwrote:


 Apparently you cannot use CFSILENT or CFSETTING inside a function at all.
 Using either of these tags in the function give me the following error:


 The start tag must have a matching end tag. An explicit end tag can be
 provided by adding /cffunction. If the body of the tag is empty, you can
 use the shortcut cffunction .../


 Robert B. Harrison
 Director of Interactive Services
 Austin  Williams
 125 Kennedy Drive, Suite 100
 Hauppauge NY 11788
 P : 631.231.6600 Ext. 119
 F : 631.434.7022
 http://www.austin-williams.com

 Great advertising can't be either/or.  It must be .

 Plug in to our blog: AW Unplugged
 http://www.austin-williams.com/unplugged



 __ Information from ESET Smart Security, version of virus signature
 database 5343 (20100805) __

 The message was checked by ESET Smart Security.

 http://www.eset.com


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336025
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Suppressing whitespace from CFCs

2010-08-05 Thread Robert Harrison

I'm running out of ideas. My output is in a CFFUNCTION in a CFC. 

Anything I wrap around CFINVOKE on the page does not affect what's inside
the CFC and it's still gives whitespace. 

Anytime I try to put CFSILENT or CFSETTING inside the CFFUNCTION is chokes
and can't find the end of the /cffuntion.

This is annoying. 

I doubt I am the only one doing output from a CFC? There has got to be a way
to kill the whitespace in a CFC when there is HTML output... although it
appears that CFSETTING, CFPROCESSINGDIRECTIVE, and CFSILENT are NOT doing
the job. 

Any other ideas?



Robert B. Harrison
Director of Interactive Services
Austin  Williams
125 Kennedy Drive, Suite 100 
Hauppauge NY 11788
P : 631.231.6600 Ext. 119 
F : 631.434.7022
http://www.austin-williams.com 

Great advertising can't be either/or.  It must be .

Plug in to our blog: AW Unplugged
http://www.austin-williams.com/unplugged

 

__ Information from ESET Smart Security, version of virus signature
database 5343 (20100805) __

The message was checked by ESET Smart Security.

http://www.eset.com
 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336026
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Suppressing whitespace from CFCs

2010-08-05 Thread Michael Grant

Robert,

The best idea is NOT to use output=true if the whitespace is an issue. It's
as simple as that. Create your content, save it to a var and pass back the
var. You seem to getting upset that your cfc is doing what it's told to do.



On Thu, Aug 5, 2010 at 11:20 AM, Robert Harrison rob...@austin-williams.com
 wrote:


 I'm running out of ideas. My output is in a CFFUNCTION in a CFC.

 Anything I wrap around CFINVOKE on the page does not affect what's inside
 the CFC and it's still gives whitespace.

 Anytime I try to put CFSILENT or CFSETTING inside the CFFUNCTION is chokes
 and can't find the end of the /cffuntion.

 This is annoying.

 I doubt I am the only one doing output from a CFC? There has got to be a
 way
 to kill the whitespace in a CFC when there is HTML output... although it
 appears that CFSETTING, CFPROCESSINGDIRECTIVE, and CFSILENT are NOT doing
 the job.

 Any other ideas?



 Robert B. Harrison
 Director of Interactive Services
 Austin  Williams
 125 Kennedy Drive, Suite 100
 Hauppauge NY 11788
 P : 631.231.6600 Ext. 119
 F : 631.434.7022
 http://www.austin-williams.com

 Great advertising can't be either/or.  It must be .

 Plug in to our blog: AW Unplugged
 http://www.austin-williams.com/unplugged



 __ Information from ESET Smart Security, version of virus signature
 database 5343 (20100805) __

 The message was checked by ESET Smart Security.

 http://www.eset.com


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336027
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Suppressing whitespace from CFCs

2010-08-05 Thread DURETTE, STEVEN J (ATTASIAIT)

Robert,

I just tested it out (CF9) and cfsilent worked fine in a cffunction in a
cfc with output=true. Maybe something in your code between the cf
silents is breaking the tag matching. Or maybe your cfsilents are in bad
positions.

I know that this bit me before (not my code, but took me a while to
figure out the problem):

cfoutput
There was stuff here...
cfsilent
There were a couple hundred lines here.
/cfoutput
/cfsilent

It caused all sorts of problems.

Steve

-Original Message-
From: Michael Grant [mailto:mgr...@modus.bz] 
Sent: Thursday, August 05, 2010 11:24 AM
To: cf-talk
Subject: Re: Suppressing whitespace from CFCs


Robert,

The best idea is NOT to use output=true if the whitespace is an issue.
It's
as simple as that. Create your content, save it to a var and pass back
the
var. You seem to getting upset that your cfc is doing what it's told to
do.



On Thu, Aug 5, 2010 at 11:20 AM, Robert Harrison
rob...@austin-williams.com
 wrote:


 I'm running out of ideas. My output is in a CFFUNCTION in a CFC.

 Anything I wrap around CFINVOKE on the page does not affect what's
inside
 the CFC and it's still gives whitespace.

 Anytime I try to put CFSILENT or CFSETTING inside the CFFUNCTION is
chokes
 and can't find the end of the /cffuntion.

 This is annoying.

 I doubt I am the only one doing output from a CFC? There has got to be
a
 way
 to kill the whitespace in a CFC when there is HTML output... although
it
 appears that CFSETTING, CFPROCESSINGDIRECTIVE, and CFSILENT are NOT
doing
 the job.

 Any other ideas?



 Robert B. Harrison
 Director of Interactive Services
 Austin  Williams
 125 Kennedy Drive, Suite 100
 Hauppauge NY 11788
 P : 631.231.6600 Ext. 119
 F : 631.434.7022
 http://www.austin-williams.com

 Great advertising can't be either/or.  It must be .

 Plug in to our blog: AW Unplugged
 http://www.austin-williams.com/unplugged



 __ Information from ESET Smart Security, version of virus
signature
 database 5343 (20100805) __

 The message was checked by ESET Smart Security.

 http://www.eset.com


 



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336028
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Suppressing whitespace from CFCs

2010-08-05 Thread Andy Matthews

The general consensus is that CFCs should be used primarily to encapsulate
logic, and data retrieval. If you want to output something it really should
be in a CFM page, or a custom tag.


andy 

-Original Message-
From: Robert Harrison [mailto:rob...@austin-williams.com] 
Sent: Thursday, August 05, 2010 9:14 AM
To: cf-talk
Subject: Suppressing whitespace from CFCs


I've moved output function into CFC's; thus I'm using output=true. Only
problem is the CFC is outputting whitespace where all the logic is now. 

How can I suppress the white space in an output CFC?



Robert B. Harrison
Director of Interactive Services
Austin  Williams
125 Kennedy Drive, Suite 100
Hauppauge NY 11788
P : 631.231.6600 Ext. 119
F : 631.434.7022
http://www.austin-williams.com 

Great advertising can't be either/or.  It must be .

Plug in to our blog: AW Unplugged
http://www.austin-williams.com/unplugged


 

__ Information from ESET Smart Security, version of virus signature
database 5343 (20100805) __

The message was checked by ESET Smart Security.

http://www.eset.com
 



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336030
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Suppressing whitespace from CFCs

2010-08-05 Thread Robert Harrison

 The general consensus is that CFCs should be used primarily to encapsulate
logic, and data retrieval. 

I think that's my consensus now also. Thought I'd be fancy and write one CFC
to contain an entire module; logic and output components. Apparently output
is best left in the CMF pages.


Robert B. Harrison
Director of Interactive Services
Austin  Williams
125 Kennedy Drive, Suite 100 
Hauppauge NY 11788
P : 631.231.6600 Ext. 119 
F : 631.434.7022
http://www.austin-williams.com 

Great advertising can't be either/or.  It must be .

Plug in to our blog: AW Unplugged
http://www.austin-williams.com/unplugged

 

__ Information from ESET Smart Security, version of virus signature
database 5344 (20100805) __

The message was checked by ESET Smart Security.

http://www.eset.com
 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336031
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Suppressing whitespace from CFCs

2010-08-05 Thread Will Tomlinson

The general consensus is that CFCs should be used primarily to encapsulate
logic, and data retrieval. If you want to output something it really should
be in a CFM page, or a custom tag.



Man, consensus scares me.  :)

Will 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336033
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Suppressing whitespace from CFCs

2010-08-05 Thread Sean Corfield

On Thu, Aug 5, 2010 at 7:13 AM, Robert Harrison
rob...@austin-williams.com wrote:
 I've moved output function into CFC's; thus I'm using output=true. Only
 problem is the CFC is outputting whitespace where all the logic is now.

 How can I suppress the white space in an output CFC?

Write the CFC entirely in cfscript (which generates no spurious
whitespace) and use writeOutput() around the stuff you want to output.

But, as others have noted, really the 'best practice' is CFCs for
logic, CFM pages for output - mainly since you don't want to be mixing
HTML (display) in with your logic.
-- 
Sean A Corfield -- (904) 302-SEAN
Railo Technologies, Inc. -- http://getrailo.com/
An Architect's View -- http://corfield.org/

If you're not annoying somebody, you're not really alive.
-- Margaret Atwood

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336034
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Suppressing whitespace from CFCs

2010-08-05 Thread Mike Kear

There are reasons to use CFCs to create output.For example i had an
application that required an output of a quite large XML file made up of
maybe 50 fragments of XML,  out of a possible 300 or so specially formatted
fragments.Each occasion the XML was created,  the logic CFC would call
the appropriate functions in the output cfc, which would produce the
relevant fragment of that XML packet, then the logic CFC would stitch them
all together into one XML packet and return it to the calling page.

In XML, if you have white space in the wrong place, it can make the whole
XML packet invalid, so this was a serious issue for the viability of the
whole application.   And as i posted in my previous email in this thread, it
worked just fine,  producing output from the CFC with no extra white space.
 But you can't just treat it as a normal cfml page inside a cfc.   You have
to create a variable, containing the bit of html you want to output,  then
pass that back to the calling page.   Otherwise,  as you've found,  you'll
get all kinds of extra white space.

As it happened, my XML packets ended up having no spaces AT ALL in them,
except for intentional spaces between words in the values of the fields.
So i know you can do what you are seeking to do.

Another application for CFCs producing output is my CF9 code generator.   I
have a CFC that examines a database table, then calls a whole series of cfc
methods,  each of which produces a fragment of code, and the logic CFC
stitches them together and writes them out to a file (or files).   Kind of
like my own form of ORM,  that i wrote before i had ever heard of the term
ORM.

You can do what you want, but as others have said I'd advise putting the
logic in one CFC, and the actual output generation in another,  just so you
organise your code.

Cheers
Mike Kear
Windsor, NSW, Australia
Adobe Certified Advanced ColdFusion Developer
AFP Webworks
http://afpwebworks.com
ColdFusion 9 Enterprise, PHP, ASP, ASP.NET hosting from AUD$15/month



On Fri, Aug 6, 2010 at 2:16 AM, Sean Corfield seancorfi...@gmail.comwrote:


 On Thu, Aug 5, 2010 at 7:13 AM, Robert Harrison
 rob...@austin-williams.com wrote:
  I've moved output function into CFC's; thus I'm using output=true. Only
  problem is the CFC is outputting whitespace where all the logic is now.
 
  How can I suppress the white space in an output CFC?

 Write the CFC entirely in cfscript (which generates no spurious
 whitespace) and use writeOutput() around the stuff you want to output.

 But, as others have noted, really the 'best practice' is CFCs for
 logic, CFM pages for output - mainly since you don't want to be mixing
 HTML (display) in with your logic.
 --
 Sean A Corfield -- (904) 302-SEAN
 Railo Technologies, Inc. -- http://getrailo.com/
 An Architect's View -- http://corfield.org/

 If you're not annoying somebody, you're not really alive.
 -- Margaret Atwood

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336048
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Suppressing whitespace from CFCs

2010-08-05 Thread Aaron Neff

Anytime I try to put CFSILENT or CFSETTING inside the CFFUNCTION is chokes
and can't find the end of the /cffuntion.

Hi Robert,

Does the following cause the above error?

cffunction name=myFunction1 output=yes
  cfsilent#now()#/cfsilent
/cffunction
cfset myFunction1() /

cffunction name=myFunction2 output=yes
  cfsetting enablecfoutputonly=yes
  1
  cfsetting enablecfoutputonly=no
  0
/cffunction
cfset myFunction2() /

I also placed the functions within a CFC, and invoked each, and, like Steven, 
saw no error w/ cfsilent (nor cfsetting) within a function. The result output 
was always digit 0. Tested in both CF9  CF9.0.1.

Thanks!,
-Aaron Neff 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336053
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Suppressing whitespace from CFCs

2010-08-05 Thread James Holmes

That isn't the same as displaying the output in the CFC. Creating and
returning output is fine; displaying it with output=true is almost
always a bad idea.

--
WSS4CF - WS-Security framework for CF
http://wss4cf.riaforge.org/

On 6 August 2010 03:10, Mike Kear afpwebwo...@gmail.com wrote:

 There are reasons to use CFCs to create output.    For example i had an
 application that required an output of a quite large XML file made up of
 maybe 50 fragments of XML,  out of a possible 300 or so specially formatted
 fragments.    Each occasion the XML was created,  the logic CFC would call
 the appropriate functions in the output cfc, which would produce the
 relevant fragment of that XML packet, then the logic CFC would stitch them
 all together into one XML packet and return it to the calling

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336056
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm