CFModule Works With Non-CFM Files

Posted February 26, 2008 at 2:49 PM by Ben Nadel

Tags: ColdFusion

The other day, I was recoding some work that involved ColdFusion files being called using CFModule. I had gotten it to the point where the new code was in place, but was breaking. I had the old code stored as a .BAK file. I wanted to test to see if the new code was breaking or if the old code would have broken also, but I didn't want to rename any files to make this test happen. Just for fun, not so much thinking it would work, I tried to use the .BAK file directly into the CFModule tag as such:

  • <!--- Run BAK file using CFModule. --->
  • <cfmodule
  • template="./tag.cfm.bak"
  • />

Much to my delight, this ran without a problem. Not much of a tip, but I think this is useful when you are debugging code and you want to compare one set of code to a backed up set of code.

Moral of the store: just as with CFInclude, CFModule does not care about file extensions.



Reader Comments

Feb 26, 2008 at 4:09 PM // reply »
8 Comments

From your title, I thought you were talking about .PHP .JSP or any other working within CFMODULE directly.

[ ]'s


Feb 26, 2008 at 4:45 PM // reply »
17 Comments

I suppose that's because everything is already running (and being parsed) by the CF engine. You could use any file extension and it'll probably work.

Of course everything operates as a 'custom tag' would, including doubling the output if you close the cfmodule etc


Feb 26, 2008 at 5:53 PM // reply »
11,238 Comments

@Fernando,

Oh sorry, I didn't even think of that :( Yeah, I just meant file extensions.


Feb 26, 2008 at 6:44 PM // reply »
18 Comments

Off topic from the post, but possibly useful to the previous comment, I believe that Sean Corfield was working on a project to handle PHP files within Coldfusion using a java library. Might be work looking at if that's something you need.


Feb 26, 2008 at 7:01 PM // reply »
11,238 Comments

@Dan,

I think he was working on a library that would run PHP scripts inline... not sure if it would work for PHP files.

http://corfield.org/blog/index.cfm/do/blog.entry/entry/ColdFusion_8_running_PHP


Feb 27, 2008 at 3:27 AM // reply »
6 Comments

I use that from time to time on .sql files, when i have a REALLY complicated SQL query.

It's easier to build it in an .sql file, let Query Analyzer check it for syntax/QA, then just have ColdFusion call the very same .sql file when it's ready for my app to use. Saves a bit of copy/paste work. :)


Feb 27, 2008 at 8:40 AM // reply »
1 Comments

Ben you might enjoy this old post from Mark Kruger about importing whole libraries of non-ColdFusion tags: http://tinyurl.com/adaptive-tags. Have never found much use for it - but it's a pretty slick trick.


Feb 27, 2008 at 8:47 AM // reply »
11,238 Comments

@Jason,

I saw that a while back. I agree - very slick, but not sure how useful it is.


Post A Comment

Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.

Please review the following issues:

Author Name:


Author Email:

Author Website:

Comment:

Supported HTML tags for formatting: <strong>bold</strong>   <em>italic</em>   <code>code</code>







  • Help Wanted - Find Your Next ColdFusion Job
Ben Nadel's Company - Epicenter Consulting Recent Blog Comments
May 21, 2013 at 7:46 PM
Using Plupload For Drag & Drop File Uploads In ColdFusion
No luck. At least I have uncovered the cause, URLScan 3.1. Here is what I see in the IIS log when a file is over 30mb. 2013-05-21 23:29:05 10.105.45.128 GET /plupload/assets/jquery/jquery-1.8. ... read »
May 21, 2013 at 6:12 PM
Using Plupload For Drag & Drop File Uploads In ColdFusion
Ben, I did not see you after Pete Freitag's Lockdown session at cfObjective but he said that IIS sets file size limits at 30MB by default which just happened to be the threshold for file size when ... read »
May 21, 2013 at 11:51 AM
Ask Ben: Parsing Very Large XML Documents In ColdFusion
Looking at my first ever XML document that I have to parse and put into MS SQL 2000 with CF8. I get it to list the desired Field name, many times over, and have a long list of this field name displa ... read »
May 21, 2013 at 9:25 AM
Turning Off and On Identity Column in SQL Server
you are awesome..i am lucky to get this blog between such a garbage one....Thanks, Prashant ... read »
May 20, 2013 at 4:38 PM
Using A Dynamic Column Name With ValueList() In ColdFusion
@Dana, Your confusion is well founded, since this is a very confusing features. In fact, it ONLY works if you use array notation. Meaning, that this: arrayToList( query[ "columnName" ] ) ... read »
May 20, 2013 at 4:34 PM
Using A Dynamic Column Name With ValueList() In ColdFusion
I was thinking chicken and the egg, I wouldn't have expected it to work in the valuelist going in I guess. Maybe I just need a beer, long day :) ... read »
May 20, 2013 at 4:29 PM
Using A Dynamic Column Name With ValueList() In ColdFusion
@Dana, That's if you're trying to reference a specific row. In this case, we're trying to reference the entire query column as one cohesive value. So, you are correct that if you wanted to output a ... read »
May 20, 2013 at 4:24 PM
Using A Dynamic Column Name With ValueList() In ColdFusion
I thought when you used array notation to reference queries you always had to have the row or it would throw a similar error as well? ... read »
InVision App - Prototyping Made Beautiful With Prototyping Tools