Sorry for coming late into this discussion...

I've got a custom tag in the onTap framework that generates cf tags as
output and was designed for this purpose originally... It's not
dependant on the framework (I don't think so anyway), and the code is
open-source, so you can download it and mangle at will. The tag's
called echo.cfm so you'd echo your cf tags in a cfsavecontent and then
write the results to the template, like this:

<cfsavecontent variable="mysource">
  <cf_echo tag="cfset myvar = blah blah">
  <cf_echo tag="cfquery" tagname="getstuff" datasource="blah">
    select * from stuff where blah ...
  </cf_echo>
  <cf_echo tag="cfmail" to="##getstuff.email##" subject="D'oh!">
    ...email content here...
  </cf_echo>
</cfsavecontent>
<cffile action="" file="#mytemplate#" output="#mysource#">

You might have to get used to the syntax for things like cfset and any
tag with a name attribute (you have to use "tagname" instead). And you
have to remember to escape pound symbols if you want the script to
contain variable references instead of literal values. Cfmodule tags
are particularly interesting to create this way. If you have a large
block of code that you can put in a cfscript block, that makes it
easier:

<cfsavecontent variable="mysource">
<cf_echo tag="cfscript">
...lots of coldfusion code...
</cf_echo>
</cfsavecontent>

This was originally part of the engine that runs templating of form
fields for custom content types in my CMS. At the time I figured it
was so obscure nobody else would ever ask for a tool to do this. :)

Enjoy! :)

s. isaac dealey                214-823-9345

team macromedia volunteer      http://www.macromedia.com/go/team

chief architect, tapestry cms  http://products.turnkey.to

onTap is open source           http://www.turnkey.to/ontap


> Matthew,

> When I had my application in CF 5.0 and MX <> needed to be
> escaped when you were not using CFSCRIPT. That's why I
> suggested going that route (its also a little cleaner to
> read since this can get pretty messy really quickly)

> Try it in these versions--- you'll get an Just in Time
> Complilation Error.

> In any case, we'll both agree that one needs to escape "
> and # unless one evaluates a variable value to be used
> within the new file. We'll also agree that its a pretty
> intresting way of setting perfernces or allowing
> administrators to really extend an application.

> Jeremy

>>Try this:
>>
>>
>>
>><cfset a="<cfoutput>123</cfoutput>">
>>
>><cfoutput>#a#</cfoutput>
>>
>>
>>
>>View the page's HTML. You should see the cfoutput tags in
>>there - at least I
>>do on 6.1.
>>
>>
>>
>>-----Original Message-----
>>From: Jeremy Brodie [mailto:[EMAIL PROTECTED]
>>Sent: Wednesday, 31 December 2003 8:54 a.m.
>>To: CF-Talk
>>Subject: Re:cf file write
>>
>>
>>
>>Since I suggested using CFscript its my bad. If you were
>>outside of CFSCRIPT
>>then you would need to escape <>.
>>
>>>Are you sure about escaping <>? Never seen that before,
>>>and when I
>>>experimented with it I just got two of each. The only
>>>thing you need to
>>>escape is ".
>>>
>>>
>>>
>>>-----Original Message-----
>>>From: Jeremy Brodie [mailto:[EMAIL PROTECTED]
>>>Sent: Wednesday, 31 December 2003 8:07 a.m.
>>>To: CF-Talk
>>>Subject: Re:cf file write
>>>
>>>
>>>
>>>Yes, you can create .cfm files from CFILE=write
>>>
>>>Here's how it world work
>>>1) Move all CF code into a single variable. My perferance
>>>would be to use
>>>CFscript synatx, since it will force you to use the
>>>correct syntax--
>>>
>>><cfscript>
>>>cftext="<<cfoutput>>
>>><<cfset var=#evaluate("myvar")#>>
>>><<cfoutput>>";
>>>// yes, you will need to double pound, double quote and
>>>double << every
>>time
>>>you need a variable or a tag
>>></cfscript>
>>>
>>><CFfile action=""> >>>file="e:\_promotrials\#trialname#\trial_include.cfm"
>>>output="#cftext#">
>>>
>>>2) test and use
>>>
>>>> Can <CFFILE> be used to write and output a cf file
>>>> (.cfm) not a text (.
>>>> txt) file?
>>>>
>>>> How would I work this?
>>>>
>>>> I have this down: <CFfile action=""> >>>> file="e:\_promotrials\#trialname#\trial_include.cfm"
>>>> output="
>>>>
>>>> It crashes when I insert info from the .cfm file that
>>>> includes quotes.
>>>>
>>>>
>>>> Roberto O.
>>>HWW
>>>
>>>  _____
>>>
>>>
>>
>>  _____
>>
>>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to