We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

CFINCLUDE equivalent for HTML only

alexerm
alexerm asked
on
Medium Priority
669 Views
Last Modified: 2013-12-24
Hi,

Is there CFINCLUDE equivalent tag that would include some html file, but would not process any CFM?

Basically I allow users to save files using my interface.

Then on my page I have the following structure:

.....my code (necessary)......
<cfinclude template="usersfile.html">
.....my code (necessary)......

Everything is fine except that user can potentially put CFM code to his file and get control of the server.

So how do I do that "cfinclude" without processing CFML inside usersfile.html

Thanks
Comment
Watch Question

Hi alexerm,

Try using <cffile>:

<cffile action="read" file="usersfile.html" variable="usersfile">
<cfoutput>#usersfile#</cfoutput>

This should render the text of the file without evaluating it as ColdFusion code.

Best Regards,

Seth

Author

Commented:
I'm trying to avoid cffile whenever is possible because of it's bad perfomance.

Is there any other ways to do it without cffile?

Thanks
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
How about saving the file as include.html and use cfinclude, I don't think it will evaluate any CF code, give it a go.

Author

Commented:
Reply to Tacobell777:

Unfortunetely, it does evaluate CF code, when using CFinclude, no matter what extension of the included file is

Alex
The only thing I can think of (other than CFFILE) is to store the page in a Database.
I never tried it, weird though.

How about, if you read the file into a variable and the output it like so

#dE(myFileVariable)#

Commented:
try this

<img src="my_cfm_or_html_or_any_file_i_need_to_execute.htm' width="1" height="1" border="0">

let me know ...

K'Rgds
Anand

Author

Commented:
Hi, Anand

The idea with <img> did not work. I would be surprised if it did work

Thanks

Alex
Did you try my idea?

I don;t know what it is lately but people ignore me, any ideas why?

Author

Commented:
Hi, Tacobell

I did not ignore your post.

If I read from file and just output variable, then there is no need to use DE(...).

Basically when I posted this question I was aware of solution that would read from file using cffile or some other custom tag and then just output whatever was read from file. (and there is no need to use DE in this solution)

However, my question was is there standard coldfusion tag that would include file like CFINCLUDE but would not process CFML inside.

Alex
I stand by my original suggestion. :)
If you read a html file with cffile, then output the result within dE() them I'm pretty sure it won't be evaluated.
dE stands for Delay Evaluation, thus is your problem is that something is evaluated then you'd want to use dE()
or in your html file that you call in the cfinclude you need to put dE() around every variable present, I'm pretty sure that will work to, if it's not dE() that works then dE(dE(variable)) will work.

Author

Commented:
Hi, Taco

-------------------------------------------------------
<cffile action="read" ......... variable="myvar">
#myvar#
-----------------------------------------------------

does not require to use DE.

My problem was that CFINCLUDE evaluates CFML.

Alex

you know what, you seem to know it all, sort it out by yourself. ciao

Author

Commented:
Tacobell,

You asked me to comment about your idea and I did

I don't understand why you got frustrated
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.