CFModule Works With Non-CFM Files

Posted February 26, 2008 at 2:49 PM

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:

 Launch code in new window » Download code as text file »

  • <!--- 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.

Download Code Snippet ZIP File

Post Comment  |  Ask Ben  |  Print Page




Reader Comments

Feb 26, 2008 at 4:09 PM // reply »
7 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 »
16 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 »
7,572 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 »
7,572 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 »
5 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 »
7,572 Comments

@Jason,

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


Post Comment  |  Ask Ben

Recent Blog Comments
Mar 20, 2010 at 12:07 PM
Drawing On The iPhone Canvas With jQuery And ColdFusion
Simply awesome. Saved my day. ... read »
Mar 20, 2010 at 9:00 AM
Building A Fixed-Position Bottom Menu Bar (ala FaceBook)
I would like to say thx for an easy way to create a bottom bar. I do have a ?. Is it possible to center the bar if i want to resize it to ex 85%. Regards Offenbach ... read »
Mar 19, 2010 at 7:26 PM
MySQL 3/4 - com.mysql.jdbc.Driver And allowMultiQueries=true
Thank you very much for this post. Adding allowMultiQueries="true" in context.xml didn't help until I added it to url as allowMultiQueries=true Good idea is to use prepared statements and it will he ... read »
Jim
Mar 19, 2010 at 4:49 PM
Nobody Puts Baby In The Corner!
Wow. This is like suddenly finding a support group for your secret shame. I'm not alone! I always liked this movie, even though it is extremely cheesy. I just wish Jennifer Grey hadn't gotten the ... read »
Mar 19, 2010 at 4:47 PM
Application.cfc OnRequest() Method Affects OnError() Arguments
@Jason and @Ben, I've been doing some CF9 refactoring on our systems and noticed an odd occurrence with onError as well. Found a way to work around my problem, but what I saw was... Background: Our ... read »
Jim
Mar 19, 2010 at 4:44 PM
Shoot 'Em Up Starring Clive Owen And Paul Giamatti
I actually enjoyed this movie quite a lot. It was different, certainly, but I think they were going for more of a Quentin Tarentino-"wow, that was weird"-vibe than an actual spoof. Once I realize ... read »
Mar 19, 2010 at 4:34 PM
An Intensive Exploration Of jQuery With Ben Nadel (Video Presentation)
Hey I guess the video is down. Is there anyway you can upload to youtube or vimeo or some other service? Greatly appreciated. ... read »
Mar 19, 2010 at 4:24 PM
ColdFusion CFPOP - My First Look
@Ben Thanks for the follow up! The root of the problem had to do with being able to trace bounced emails to specific records in a DB table. Let's say you run an email campaign and you get 1,000 bou ... read »