Maybe I mis-communicated my delima, here it is in code...
I want to write a CF template using CFFILE - I know what the template will
look like, but need some variables resolved.
The only way I have foud to work is:
1) Set var to the entire contents of the page
2) use the < > " to replace these characters
3) Use a special character (I use ` ) to replace the pound signs
4) keep poound signs where a dynamic var will be resolved
5) Do a series of Replace() functions on this var before I pass it to CFFILE
THERE HAS TO BE A BETTER WAY????
Example:
Section A - is the actual page code I want to generate, with all character
that cause a problem replaces with something else. This is needed beacuse a
<, >, or " inside a CFSET (or inside teh CFFILE) will cause the tag to
fail.
Section B - Replaces these characters with their real character
Section C - Writes the file
<!--- SECTION 'A' --->
<cfset PageCode ="
<html>">
<body bgcolor="#variables.myBGColor#">
some page text
`variables.SomeVar`
</body>
</html>
">
<!--- SECTION 'B' --->
<cfset ValidationError = Replace(Variables.ValidationError, "`","##",
"All")>
<cfset ValidationError = Replace(Variables.ValidationError, "<","<",
"All")>
<cfset ValidationError = Replace(Variables.ValidationError, ">",">",
"All")>
<cfset ValidationError = Replace(Variables.ValidationError, ""","""",
"All")>
<!--- SECTION 'C' --->
<cffile action="WRITE"
file= C:\...\Page.cfm"
addnewline="Yes"
output="#Variables.PageCode#">
QUESTION: Is these a better way to do this???
More efficient? Better code?
jp
_____________________________________________________________________________________
Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists