House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home / Groups / ColdFusion Talk (CF-Talk)

Paired Custom Tags

Author:
Jennifer Dodson
09/26/2006 06:06 PM

Can anyone point me at a good resource for learning about writing a Paired custom tag?  I'm having a little trouble with the one I started on yesterday. Basically what we're trying to do is "overload" the cfmail tag so that we can make it work differently on different servers. I have created a tag with a start and stop which I think is pretty good. When you call it it does generate an email like you'd expect, but the content of the mail tag also displays on the screen which is a little less than ideal.  If anyone's got some pointers on how to get this working right I'd appreciate it.  I think it will work out pretty nice once I get over this learning hump. Jennifer Dodson. ----------------------- Here's how I'm calling it: <cf_infonetEmail_2   to="jdodson@pioneerservices.com"   from="jdodson@pioneerservices.com"   subject="did this work?"> Just wanted to see if this worked or not. #CGI.PATH_INFO# #DateFormat(Now(),"mm/dd/yyyy")# </cf_infonetEmail_2> And here's the code I'm using (keep in mind this is just the rough starting point). <!---Determine if you're in the start tag or the end tag---> <cfif ThisTag.ExecutionMode EQ "Start">   <!---Parse apart the attributes and set them to the correct values--->   <!---Mail template to allow for "shutting" off the mail tag on development machines--->   <cfparam name="Attributes.Type" default="plain">       <cfparam name="Attributes.cc" default="">   <cfparam name="Attributes.bcc" default="">   <cfparam name="Attributes.attachment" default="">   <!---If the Server is not live then send to the User--->   <cfif CGI.Server_Name is not "InfoNet">     <!--- the session.associateusername is not defined for scheduled tasks--->     <cfif isDefined("Session.AssociateUserName")>       <cfset Attributes.To = Session.AssociateUserName&"@pioneerservices.com">       <cfif Attributes.cc is not "">         <cfset Attributes.cc = Session.AssociateUserName&"@pioneerservices.com">       </cfif>       <cfif Attributes.bcc is not "">         <cfset Attributes.bcc = Session.AssociateUserName&"@pioneerservices.com">       </cfif>     <cfelse>       <cfset Attributes.To = "junkemail@pioneerservices.com">       <cfif Attributes.cc is not "">         <cfset Attributes.cc = "junkemail@pioneerservices.com">       </cfif>       <cfif Attributes.bcc is not "">         <cfset Attributes.bcc = "junkemail@pioneerservices.com">       </cfif>       </cfif>   </cfif> <!--- If we're at the end tag, then go ahead and send the email---> <cfelse>     <cfif Attributes.attachment is "">       <cfmail         to="#Attributes.To#"         cc="#Attributes.cc#"         bcc="#Attributes.bcc#"         from="#Attributes.From#"         subject="#Attributes.Subject#" type="#Attributes.Type#">#ThisTag.GeneratedContent#</cfmail>   <cfelse>     <cfmail       to="#Attributes.To#"       cc="#Attributes.cc#"       bcc="#Attributes.bcc#"       from="#Attributes.From#"       subject="#Attributes.Subject#"       mimeattach="#Attributes.attachment#"       type="plain">#ThisTag.GeneratedContent#</cfmail>   </cfif> </cfif> Jennifer Dodson Sr. Development Analyst Pioneer Services 4700 Belleview Suite 300 Kansas City, MO 64112 Phone 816-448-2391 Fax 816-756-0942 jdodson@pioneerservices.com ---------------- PIONEER SERVICES is a brand name and registered service mark of Pioneer Licensing Services, Inc., where its use is duly licensed to affiliates and partners of Pioneer Licensing Services, Inc. Confidentiality Notice: The information contained in this e-mail transmission, including any attachments, is confidential information, proprietary to the sender and legally protected. Its purpose is intended for the sole use of the individual(s) or entity named in the message header. If you are not the intended recipient, you are hereby notified that any dissemination, copying or taking any action in reliance on the contents of this information is strictly prohibited. If you received this message in error, please notify the sender of the error and delete this message and any attachments.


Search cf-talk

May 25, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference