Dave,
I set up all the sub variables before I call the mail tag with the loaded
variable. I worked through a solution that loops over each #cfvariable# and
#evaluates()# it:
<CFLOOP CONDITION="newpos GREATER THAN 0">
<cfset var_name="#mid(string,str.pos[1],str.len[1])#">
<cfset var_content="#Evaluate(var_name)#">
<cfset string=#Replace(string, var_name, var_content, "all")#>
<cfset str="#REFind("(##[A-Za-z][A-Za-z0-9_]*##)", string, newpos,
"true")#">
<cfset newpos=#str.pos[1]#+#str.len[1]#>
</cfloop>
There is actually a tag on the developer's exchange called cf_evaluate. It
uses a temporary file, though. The variable is stored in the temporary file
and then <cfinclud>ed. A similar concept would also work well for me. Just
keep all my mail messages in files and then include them.
Thanks for everyone's suggestions.
-Neil
-----Original Message-----
From: Dave Hannum [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 26, 2000 12:38 PM
To: [EMAIL PROTECTED]
Subject: Re: substituting variables in a variable
Where is #first_name# coming from? Your query? IF so, make sure you're
referencing the query in the CFMAIL tag. Is it from a form? IF so, make it
#FORM.first_name#. Is it from another query? IF so, reference that query
in the output call.
#QueryName.first_name#
It works for me.
Dave
=================================
"What we need is a list of specific unknown problems we will encounter"
David Hannum
Web Analyst/Programmer
Ohio University
[EMAIL PROTECTED]
(740) 597-2524
----- Original Message -----
From: "Lon Lentz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 26, 2000 12:29 PM
Subject: RE: substituting variables in a variable
I've tried this before with no luck. I use place holders and do replaces
on those values.
Lon Lentz
Applications Developer - Alvion Technologies
DataWarehousing and List Sales - Market Your Lists on the Net!
[EMAIL PROTECTED]
941-574-8600 Ext. 210
-----Original Message-----
From: Neil Peaslee [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 26, 2000 10:17 AM
To: cf-talk
Subject: substituting variables in a variable
I am trying to set up a mail system that can grab text from a database and
insert it into a mail message. I also need to customize the text of the
message (e.g. Dear #first_name# evaluates to Dear John). The problem arises
when I insert the mail text variable into the <cfmail> tag. The variables
that are contained in the text message are not evaluated.
<cfmail ..>
#mail_message#
</cfmail>
This will output "Dear #first_name#, ..."
How do I get the sub variable to be evaluated?
Thanks in advance,
Neil
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.