• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Which Application.cfc get executed?

Engaged ,
Jun 22, 2016 Jun 22, 2016

Copy link to clipboard

Copied

I'm working on a clients system that has a library of CFC's in a folder called /Admin/cfcs.   Inside that folder is an Application.cfc file.

There is also an Application.cfc file at the root directory.  Off the root directory are other folders in addition to the Admin folder.

When I execute the template /Members/Index.cfm a few of the methods from the CFC library get executed.

If there aren't any calls to the CFC library I'm 100% sure the Application.cfc in the root folder gets executed when I run any of the templates in any folder off  the  root folder.

My question is if a template, such as /Members/Index.cfm, invokes a method from the CFC library does the Application.cfc template in the /Admin/cfcs folder get executed or is the root Application.cfc the one executed.

I believe it's just the root one but I'm not 100% sure. 

Any thoughts???  Does having an Application.cfc in the library folder cause any issues???

Thanks in advance for the assist!

Views

395

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jun 22, 2016 Jun 22, 2016

Your assumption is correct.  The application.cfc in /Admin/cfc is not being executed, at all, unless there is a .cfm file that is being somehow utilized.  The CF Server first searches the current .cfm document folder for application.cfc/cfm; if it doesn't find it, it keeps recursively searching lower and lower folders until it finds an application.cfc/cfm and executes it.  CFCs in a folder with an application.cfc/cfm do not execute another application.cfc/cfm; they rely on the one that was alrea

...

Votes

Translate

Translate
LEGEND ,
Jun 22, 2016 Jun 22, 2016

Copy link to clipboard

Copied

Your assumption is correct.  The application.cfc in /Admin/cfc is not being executed, at all, unless there is a .cfm file that is being somehow utilized.  The CF Server first searches the current .cfm document folder for application.cfc/cfm; if it doesn't find it, it keeps recursively searching lower and lower folders until it finds an application.cfc/cfm and executes it.  CFCs in a folder with an application.cfc/cfm do not execute another application.cfc/cfm; they rely on the one that was already executed before loading the requested .cfm file.

HTH,

^_^

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 24, 2016 Jun 24, 2016

Copy link to clipboard

Copied

LATEST

That's what I thought too.  I just wanted to be sure there wasn't anything special happening behind the scenes when including a file from a directory that also has an App.cfc file.

Thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation