Need my application.cfm file converted to application.cfc

I uploaded a copy of our application.cfm file. I've spent so much time attempting to convert it to application.cfc but have failed. I just cannot understand the terms and language. That's why I'm here.

I need someone to convert the uploaded application.cfm to application.cfc. I had to rename the file to gak.html to get it to upload here.

This is running on ColdFusion 11 Enterprise and Windows Server 2012 R2 and SQL 2008.

I'm afraid that pointing me to links to get the job done won't help. Surely this cannot be too difficult for experts, of which I will never be.
gak.html
Grover McBroomAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

_agx_Commented:
Keep in mind there are some slight differences in behavior between Application.cfm/cfc, so be sure to test the various scenarios, but the structure that comes the closest to what you have now is using OnRequestEnd.  See attached. Start with that and make changes if needed.
1
_agx_Commented:
Edit:

that comes the closest to what you have now is using OnRequestEnd

Correction: That should've read  OnRequest

Here's an example of your Application.cfc  (change file extension from .txt to .cfc)
Application.txt
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Grover McBroomAuthor Commented:
I just inserted your application.cfc file and IT WORKS!

I feel as tho I had just stepped off a cliff and landed on your bridge. I've put this off far too long and now, finally, I can use application.cfc.

Two questions:

1) My application.cfm is still in place. Do I leave it there? If I remove it I'll need to search system wide where .cfm files point to it from another folder-deep application.cfm.  

2) do I replace my other application.cfm files not in the root, now pointing to application.cfm or do I leave them and point back to the root application.cfc?

Not sure what you meant by "OnRequest". Is that something more I need to do?

Thanks so much! I was beginning to worry I'd never find help here again. You always come through!
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

_agx_Commented:
Glad  I could help.  Even though Application.cfc basically does the same thing (and more), structurally it's a very different beast.  Takes some getting used to.

RE: 1&2 -  Unless you're doing something else beyond switching from .cfm->.cfc, you shouldn't need to change anything.  If a directory contains both an Application.cfm and Application.cfc file, CF only uses the Application.cfc and ignores the Application.cfm.  So it should work the same as before.  

Not sure what you meant by "OnRequest". Is that something more I need to do?

Nope.  As I'm sure you noticed, Application.cfc uses various functions (OnRequestStart, OnRequest, ....).  Just mentioning that the function that's most similar to the <cfapplication> behavior is OnRequest.
1
Grover McBroomAuthor Commented:
I'll need to study up on them, best I can. Lots to learn from CF8, Win2003, and SQL2000. Lots. Keep me busy for a couple decades.

So, I'll assume I should leave the old application.cfm files, even those in deeper folders pointing back to the root application.cfm, leave them alone, that they are not required to point to the new application.cfc, right?

There are some functions requiring application.cfc that should work now, thanks to you.
0
_agx_Commented:
So, I'll assume I should leave the old application.cfm files, even those in deeper folders pointing back to the root application.cfm, leave them alone, that they are not required to point to the new application.cfc, right?

For the one in the root folder, leaving both files won't harm anything, but it is up to you whether you want to keep them both.  For the deeper folders, yes should not need to change anything.  CF should behave the same as it's always done. It'll search for the closet Application file to whatever script you're running and use that one.  It first searches the current folder containing your cfm/cfc file for an Application file. If it's found, CF uses that one and stops looking.  If not, CF checks the parent directory, grandparent directory, etc... until it finds one.

So say you have this structure:

--rootFolder
|----> Application.cfc                
|----> index.cfm
|--------- folder
|------------->  OtherPage.cfm
|----------------- deeperFolder
|----------------------> Application.cfm        
|---------------------->  SomePage.cfm          

* When you run /index.cfm, CF will use  /root/Application.cfc

* When you run /root/folder/deeperFolder/SomePage.cfm, CF will use /root/folder/deeperFolder/Application.cfm, and ignore /root/Application.cfc.  Same as it did when you were using all Application.cfm files.

* When you run /root/folder/OtherPage.cfm, CF looks in /root/folder for an application file. It doesn't find one, so it checks the parent folder ie "/root/".  It does find one there, so it uses /root/Application.cfc.  Again, this is the same way it works with Application.cfm files.
1
Grover McBroomAuthor Commented:
Great. That's the basic way I understood it and now with your detailed explanation, I feel lots more confident.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft IIS Web Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.