CFSETTING in Application.cfc
Posted by Steve Onnis at 11:02 AM
0 comments - Categories:
Coldfusion | General
With the introduction of the Application.cfc the <CFSETTING> tag could no longer be just put at the top of your Application file. To use it you would need to include it in your OnRequest method of your Application.cfc.
Now a new problem has arisen. With ColdFusion 9 you can now create your ColdFuson components using purely CFSCRIPT. Many tags now have a CFSCRIPT equivilent which is great but one tag seems to be missing from the CFSCRIPT equivilents, the <CFSETTING> tag. So the question is if there is no way to apply cfsetting contraints via CFSCRIPT, how would you go about applying a global setting through your Application.cfc?
The only way you can really do it is to include an external cfm file into your request function using the CFSCRIPT include like this
component
hint = "That Application CFC"
{
this.name = "applicationName";
public void function onRequestStart(targetPage) {
include "settings.cfm";
}
}
The "settings.cfm" file would then contain your <CFSETTING> tag with the required attributes.