?
Solved

Coldfusion cfsavecontent

Posted on 2013-06-17
2
Medium Priority
?
1,156 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 1000 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

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
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.
Suggested Courses

764 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