Barney,

Well, as I said, in this case the prinicple of least surprise would have 
effused a behavior wherein the page calling the custom tag would not have 
rendered the content, leaving that responsibility to the tag itself. In _my_ 
mind, anyway. I mean, if the tag is supposed to receive the content, the 
calling page really has no business rendering the content again.

And not being able to stop it from being rendered again is a serious drawback.  
I mean, think of the lowly EM tag.  It takes the input and renders the content 
in italics (or whatever). The browser doesn't then render the content again 
UNitalicized, correct? It trusts the EM tag to take care of its business. Isn't 
that the way a tag should work?

I'll try your suggestion, below, but I've already gone the less elegant route 
of using cfsavecontent around my content and pushing the resulting variable as 
an attribute into the now-self-closing custom tag.

Mik


At 03:23 PM 11/4/2009, Barney Boisvert wrote:

>just do <cfset thisTag.generatedContent = "" /> in the end tag?
>
>CF has to do one or the other (render the output or suppress the
>output), and then provide a means to accomplish the other.  At least
>from the perspective of the principle of least surprise, rendering the
>output seems like the correct default choice.
>
>cheers,
>barneyb
>
>On Wed, Nov 4, 2009 at 12:16 PM, Mik Muller <[email protected]> wrote:
>>
>> Hmm.... having never made a custom tag with an open and close pair, I didn't 
>> realize that the contained content will display twice.
>>
>> http://www.mail-archive.com/[email protected]/msg29687.html
>>
>> No way around this?  It seems pretty stupid that CF wouldn't suppress the 
>> initial output, leaving the responsibility of displaying the content to the 
>> tag.
>>
>> Mik
>>
>>
>> At 01:25 PM 11/4/2009, Michael Muller wrote:
>>
>>>Hey all
>>>
>>>I'm trying to make a custom tag for cfmail so I can create a standard From, 
>>>Subject, and HTML layout inside the email that is sent.
>>>
>>>I have created the tag and am using the open / close method, but the content 
>>>of the email winds up being displayed on the page, as well as being emailed. 
>>>I'm using THIS.generatedContent inside the custom tag in the body of the 
>>>cfmail tag, and have even tried wrapping the tag inside a cfsilent.
>>>
>>>What am I missing?  How do I stop the body of the custom tag from 
>>>displaying, or is that not possible.
>>>
>>>Mik
>>>
>>>
>>><cf_mailsend to="[email protected]">yadda yadda</cf_mailsend>
>>>
>>>====
>>>
>>><cfsilent>
>>><cfswitch expression="#thisTag.ExecutionMode#">
>>>
>>><cfcase value="start">
>>><cfparam name="attributes.to" default="">
>>></cfcase>
>>>
>>><cfcase value="end">
>>><cfmail to="#trim(attributes.to)#" subject="subject" from="[email protected]" 
>>>type="HTML">
>>><div style="padding:20px; margin:20px; border:2px solid blue;">
>>>#trim(thistag.generatedcontent)#
>>></div>
>>></cfmail>
>>></cfcase>
>>>
>>></cfswitch>
>>><cfsilent>
>>>
>>>
>>>--------
>>>Michael Muller
>>>office (413) 863-6455
>>>cell (413) 320-5336
>>>skype: michaelBmuller
>>>http://MontagueWebWorks.com
>>>
>>>Information is not knowledge
>>>Knowlege is not wisdom
>>>
>>>Eschew Obfuscation
>>>
>>>
>>>
>>
>> 
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328049
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to