I wrote an exhaustive explanation of how paired custom tags work in Advanced 
Macromedia ColdFusion MX 7 Application Development (Ben's book).  It goes over 
just about everything you'll need to know about advanced use of paired custom 
tags.
Respectfully,

Adam Phillip Churvis
Certified Advanced ColdFusion MX 7 Developer
BlueDragon Alliance Founding Committee



Get advanced intensive Master-level training in
C# & ASP.NET 2.0 for ColdFusion Developers at
ProductivityEnhancement.com

  ----- Original Message ----- 
  From: Jennifer Dodson 
  To: CF-Talk 
  Sent: Tuesday, September 26, 2006 6:05 PM
  Subject: Paired Custom Tags


  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="[EMAIL PROTECTED]"
  from="[EMAIL PROTECTED]"
  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 =
  "[EMAIL PROTECTED]">
  <cfif Attributes.cc is not "">
  <cfset Attributes.cc =
  "[EMAIL PROTECTED]">
  </cfif>
  <cfif Attributes.bcc is not "">
  <cfset Attributes.bcc =
  "[EMAIL PROTECTED]">
  </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
  [EMAIL PROTECTED]



  ----------------
  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.


  

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254334
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