Solved

Coldfusion cfsavecontent

Posted on 2013-06-17
2
1,009 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
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 video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

707 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

17 Experts available now in Live!

Get 1:1 Help Now