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

Multiple Application files?

Community Beginner ,
Jun 13, 2006 Jun 13, 2006
Can you have more a second one in a sub directory?

/appication.cfm
/members/application.cfm

Can this work as long as you give the session a different name?
336
Translate
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
Guest
Jun 13, 2006 Jun 13, 2006
ColdFusion looks in the current directory for Application.cfm. If it finds it, it uses it. If it does not find it, it starts looking up the directory tree until it finds one. It does not look down to subdirectories.
Translate
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
Guest
Jun 13, 2006 Jun 13, 2006
If you are trying to have "application.cfm" files in subdirectories jdeline is absolutely correct. ColdFusion will only execute the first one it comes to in the directory tree. But, I have seen some coders have a root "application.cfm" file, and then have multiple "_application.cfm" in various subdirectories. The underscore at the beginning of the file name will put the file at the top of the list of files in the directory, and ColdFusion will ignore the file until you execute it. In the root "application.cfm" you can have some logic code (i.e., a CFIF statement) you can use to execute the appropriate "_application.cfm" file when you want it executed. For example, I've seen some coders have their CFIF statement look for a directory's name in the CGI.SCRIPT_NAME variable before it executes a CFINCLUDE for the "_application.cfm" file located in the desired subdirectory.
Translate
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
Explorer ,
Jun 13, 2006 Jun 13, 2006
LATEST
Another way of organizing multiple application.cfm files is to have one in the root directory with code that you want to always be executed. Other copies of application.cfm in subdirectories will contain code specific to their directory and will also, cfinclude the main application.cfm in the root directory.

This means that the code in root/application.cfm will always get executed and subdirectory-specific code in the subdirectory/application.cfm will only get executed for files in that subdirectory.

This is the approach that I've seen used most often.
Translate
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