Tony asks:
When an application.cfm and an application.cfc file are both in the root of an application, do both get executed? Or does the .cfc take over, and the .cfm is just ignored?
First off - I wouldn't put both files in the same folder. ColdFusion won't throw an error, but I still wouldn't do it. That being said - if both exist, the CFC version will run instead of the CFM. They definitely do not both run.
By the way - this surprised me. CF is normally super backwards compatible. I had assumed the CFM file would win over the CFC.
Archived Comments
I learned in a CFUG preso Simon gave that it is a feature that both can exist in the same directory. If, when you are developing your Application.cfc, if you ever have an issue, simply rename your Application.cfc to something else, and Application.cfm will take right back over. That's about the only good thing I've ever heard. I know it isn't much, but hey, at least it is something!
Just to clarify, because you imply this but dont explicitly say it, this applies to cfmx 7 +. In anything less the Application.cfc will be ignored.
Also, I wanted to point out something I came across this week in linux. if you are using application.cfm, little-a application.cfm does not execute before every request, only big-A Application.cfm does.
Yep, all true.
Ray I'm trying to send you a JEDI question but your form doesn't work in FireFox. When you click submit it goes to your Camden family homepage. Here was the question:
Here' something that has errked me for sometime now and maybe you know the answer or a way around it. Why is it that CFMAIL now throws an error when it encounters a badly formatted email address instead of just continuing along like it did under CF5?
One more thing. I noticed that there is a bug in the comments. When you enter in a website, if you don't put http:// in front of it, the link gets messed up. See the website of the previous post vs this one.
Tony - what URL were you at when you tried to post the question?
You asked if anyone reads the readme files... yes.
As for your question, I do not know. I wish it would not. The safest thing I guess is to ensure your email addresses are valid, but that is pretty easy under cf7: isValid("email", ....)
I was surprised to learn that its one or the other, but realistically your application should either follow one or the other model.
Personally I tried and tried to learn about app.cfc but found so many new ways to create error messages, and things not working when I expected them to. It allows greater control over CF's execution, but I found I was not ready for that control yet.
I went back to the app.cfm model because to me, its doing just fine. I think that app.cfc needs some work and please - more documentation and examples!!
* Not directed to Ray, but to MM. Ray's examples/posts/gracious email support helped me get a lot further than the docs did.
http://www.camdenfamily.com...
Hmpth. Well, don't go there. ;) Go to ray.camdenfamily.com. I need to add some code to check for that host and redirect to ray.
>in linux. if you are using application.cfm, little-a >application.cfm does not execute before every request, only >big-A Application.cfm does.
Arghhh! As if it's not bad enough for us windoze boys to have to deal with arcane command line stuff ... this! Thanks very much, sanity restored!
Unconfirmed... I read an article earlier today that said Application.cfc only overides Application.cfm if the version of ColdFusion is MX 7 or greater
Since Application.cfc came with CF7, wouldn't that make sense?
Well, when you put it that way, it does. I was unaware of exactly when Application.cfc was introduced, and obviously got mislead by reading the wrong blog. Thanks for the clarification.
I don't encounter many people who still use 6, so forgive me if it wasn't obvious. :) If you really are, I'd definitely consider upgrading to 9.