Solved

Coldfusion cfsavecontent

Posted on 2013-06-17
2
1,055 Views
Last Modified: 2013-06-17
I am using a cfsavecontent tag to write the results from a database to a index.cfm page. The problem I am experiencing is that the cfsavecontent hard-codes the cfincludes as well. This is a problem because some of the cfincludes  will change over time.
I am not sure if there is a coldfusion or javascript way of simply ensuring that
<cfinclude template="/advert/rt_300x250.cfm">
remains within the code not the contents of the rt_300x250.cfm.

Here is a short example

<cfsavecontent variable="cachedOutput">

<cfinclude template="/advert/rt_300x250.cfm">
</cfsavecontent>


<cffile action="write"
file="#hardNewPathUrlDestintation#\index.cfm"
output="#cachedOutput#">

Open in new window

0
Comment
Question by:swaggrK
2 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 250 total points
ID: 39254224
You need to escape the CF tag, so it doesn't execute.  I don't think htmleditformat will do it.. Maybe something like?

<cfsavecontent variable="cachedOutput">
<cfoutput>#chr(60)#cfinclude template="/advert/rt_300x250.cfm"></cfoutput>
</cfsavecontent>

There may be better options, but I can't think of any off the top of my head.
0
 

Author Comment

by:swaggrK
ID: 39254265
That worked. Great! Thanks!
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now