This is what I do when writing code generators. I create templates and
"escape" them so they do not execute like so

<cfsavecontent variable="bla">
<^cfoutput>
 <^input type="hidden" name="#MyPK#" value="##url.#MyPK###">
<^cfif action eq "edit_#query_name#">
 <^input type="hidden" name="event"
value="#query_name#_edited.##Section##.##nav##">
<^cfelse>
 <^input type="hidden" name="event"
value="#query_name#_added.##Section##.##nav##">
<^/cfif>
<^/cfoutput>
</cfsavecontent>

And then strip out the carets like so

<cffunction name="CleanCode" displayname="CleanCode" access="public"
hint="I Clean the Code before writing it to disk" output="false"
returntype="string">
 <cfargument name="MyCodeString" displayname="My Code String" hint="The
Code to be cleaned" type="string" required="true" />
 <cfreturnvar  replace(arguments.MyCodeString,"<^","<","all") >
</cffunction>

If you want to learn more about code generation check out the code
generator apps on RiaForge
http://www.riaforge.org/index.cfm?event=page.search#generator

I learned a lot from Brian Rinaldi's Illudium PU-36 Code Generator
http://cfcgenerator.riaforge.org/

Look at the CFML templates that he uses if you are not familiar with XSL.

HTH
G!

On Sun, Oct 14, 2012 at 9:31 PM, Russ Michaels <r...@michaels.me.uk> wrote:

>
> cfsavecontent is actually a plain cfml custom tag, so you could just take a
> copy of it and put inside your site and modify it not the render the
> content.
>
> On Sun, Oct 14, 2012 at 11:52 PM, wayne Gregori <w...@sfnet.com> wrote:
>
> >
> > Russ,
> >
> > here's what I'm doing now... can you suggest the easiest way to save
> > this content to a variable?
> >
> >
> > <!--- save to html file and write to disc --->
> > <cfsavecontent variable="htmlDoc">
> > <cfinclude template="includes/master_plugin_realestate.cfm">
> > </cfsavecontent>
> > <cffile action="write"
> > file="/home/www/
> >
> www.gregorigroup.com/htdocs/market_data/#trim(findregions.command_prefix)#_#dateformat(now(),'mm-dd-yy')#.cfm
> "
> > output='#htmlDoc#' mode=777>
> >
> > Thanks
> >
> >
> > On Sun, 2012-10-14 at 23:45 +0100, Russ Michaels wrote:
> > > you will need to NOT use cfsavecontent in that case.
> > > Just put the content into a variable and use CFFILE to save it.
> > >
> > > On Sun, Oct 14, 2012 at 10:58 PM, wayne Gregori <w...@sfnet.com> wrote:
> > >
> > > >
> > > > I'm using cfsavecontent to create a bunch of .cfm files.  I need to
> > > > include a few lines of coldfusion code but I cannot figure out how to
> > > > include them into my templates without coldfusion executing them
> rather
> > > > than including them in the template in raw text format?
> > > >
> > > > Any ideas?
> > > >
> > > > Thanks,
> > > > Wayne
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352907
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to