Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q3011 In ASP, there's a "Global.asa" that executes whenever an ASP page is called. Is there such thing for ColdFusion?

You are here: irt.org | FAQ | ColdFusion | Q3011 [ previous next ]

Absolutely. The template is called "application.cfm". Whenever you call a CFML template, ColdFusion checks to see if there is an "application.cfm" template in the same directory, and executes it first if it does. If it doesn't find the application template, it continues up the web directory tree, all the way to the web root, searching for an "application.cfm". It stops searching when a) it finds and executes the first "application.cfm" found, or b) it reaches the web root and no application templates are found.

The application template can contain any CFML or HTML tags, just like any regular CFML template. Common uses for the "application.cfm" include defining application-wide variables, and including CFAPPLICATION and CFERROR tags for the entire application.

Feedback on 'Q3011 In ASP, there's a "Global.asa" that executes whenever an ASP page is called. Is there such thing for ColdFusion?'

©2018 Martin Webb