Featured post
coldfusion - How do I force evaluation of a cfif stored in a string? -
i trying store coldfusion code in database used subject of cfmail. code stored follows:
"re: <cfif mydata.general.legalname neq """"> {{dotlegalname}}<cfelse>{{docketlegalname}}</cfif>, dot## {{dot}}, docket ##(s) {{docketstring}}"
when retrieve string database, use cfsavecontent attempt evaluate it.
<cfsavecontent variable="subject"> <cfoutput>#mydata.email.subject#</cfoutput> </cfsavecontent>
i tried
<cfsavecontent variable="subject"> <cfoutput>#evaluate(mydata.email.subject)#</cfoutput> </cfsavecontent>
and replace {{ }} appropriate values.
however, subject of email stubbornly refusing contain evaluated cfif, , instead showing cfif if string.
any ideas?
the way dynamically evaluate code creating @ runtime via writing out file, , executing it.
the easiest way write .cfm page in virtual file system (probably name file after uuid, it's unique), , need run contents.
i wouldn't advocate generating code @ runtime this, can elegant solution in cases.
as alternative, instead of storing cfml code in database, have set of cfml email template files stored in directory on server, , in database record template needs included either via cfinclude or cfmodule.
- Get link
- X
- Other Apps
Comments
Post a Comment