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

Application include subsites

Community Beginner ,
May 01, 2012 May 01, 2012

Copy link to clipboard

Copied

I have a site that has the Application.cfc that has the cfinclude in it.  However, it is appearing on subsites that are also Coldfusion sites.  Is there a way to dictate what pages the application.cfc applies to? 

Please help

Views

375

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
Participant ,
May 01, 2012 May 01, 2012

Copy link to clipboard

Copied

LATEST

Application.cfc is invoked for any CF page.  When you request a CF page, it will first check the same directory as the file requested for Application.cfc.  If it finds it, it will invoke the methods following the Application life cycle.  If it does not find an Application.cfc, it begins to crawl up the file system to the parent directory until it does find one.  If none is found, the request is handled through the unnamed application scope, which is generally considered bad practice and can lead to weird issues.

So, if you don't want a specific subdirectory to use the root directory's Application.cfc, then simply create a new Application.cfc within the subdirectory.  It will then run in a separate application scope, and will not invoke the root Application.cfc (unless you extended it, of course).

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