Patricia and others,

Thanks for your replies, everyone. Patricia's solution is the sort of
answer I was looking for.

I didn't want to use a trimmed caller variable, as doing so is three
times more complicated than just getting the results via the custom
tag itself. Fine for me, but I intend this to be used by others in my
company, and the simpler the usage the better.

So, I can use:
<cf_MyCustomTag>

Instead of :
<cf_MyCustomTag>
<cfoutput>#trim(myCallerVariable)#</cfoutput>

See the value in this? Hope it helps someone else. There is a way for
my tag to set a caller variable, however, without automatically
outputting the custom tags result in place of the custom tag call:
<cf_MyCustomTag returnOutput="No">
<cfoutput>#myCallerVariable#</cfoutput>
<!--- this doesn't need a trim, since it's not the variable itself
that had been getting the extra spaces --->

The returnOutput is an optional attribute in my tag, and you omit it
to return the value in place of the custom tag call itself.

Thanks again,
Jamie
P.S. Here is a third alternative, if, for some reason, you're avoiding
tags in your custom tag (just a use of the CF comment markers):
<cfsetting enablecfoutputonly="Yes"><!---
Author: Jamie Jackson
Name: MyCustomTag
---><!--- 
 ---><cfparam name="attributes.conversion" default=""><!--- 
 ---><cfparam name="attributes.dateTime" default=""><!--- 
 ---><cfparam name="attributes.returnOutput" default="Yes"><!--- 
 ---><cfscript>
Processing code here
</cfscript>

On Thu, 17 May 2001 16:49:15 -0400, in cf-talk you wrote:

>Use <CFSCRIPT></CFSCRIPT> in conjunction with <CFSETTING>
>
>CFSCRIPT will cancel ALL output... even that inside of <CFOUTPUT> tags.  So
>I suggest this configuration (tried and testing in CF pages that send info
>to MM Generator.. one of the pickiest White Space haters on the planet).
>
><cfsetting enablecfoutputonly="yes">
><CFscript>
>       [all kinds of stuff here, building one string]
></cfscript>
><cfoutput>#thestring#</cfoutput>
>
>
>|-----Original Message-----
>|From: Jamie Jackson [mailto:[EMAIL PROTECTED]]
>|Sent: Thursday, May 17, 2001 4:01 PM
>|To: CF-Talk
>|Subject: EnableCFoutputOnly not cutting the mustard in Custom Tag
>|
>|
>|I've got a custom tag which returns a small string, but I can't get
>|rid of the extra spaces around the string when it's called. This has
>|screwed me up several times, and I haven't found a solution yet.
>|EnableCFoutputOnly gets rid of most of the garbage whitespace, but it
>|leaves a space to the left and right of the desired output string.
>|
>|####### Custom Tag ########
>|<cfsetting enableCFoutputOnly="yes">
>|<cfscript>
>|FinalValue = result_of_a_bunch_of_processing;
>|writeOutput(FinalValue);
>|</cfscript>
>|<cfsetting enableCFoutputOnly="no"
>|
>|####### Calling Script ########
>|FinalValue = "<cf_MyCustomTag>"
>|
>|###### Results in Browser ######
>|FinalValue = " result_of_a_bunch_of_processing "
>|
>|But, I would like to see:
>|FinalValue = "result_of_a_bunch_of_processing"
>|
>|See those spaces that show up? What's causing them? How do I get rid
>|of them?
>|
>|Obviously there are workarounds, such as:
>|*Send the string back to the calling script with caller.FinalValue
>|
>|However, I would like to know if this can work without going the
>|caller-scope route.
>|
>|Thanks,
>|Jamie
>|
>|
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to