Core Framework: Application Settings

An optional feature provided by the framework is the use of configurable application settings. These are application-wide variables that may be used by each individual application. These settings are loaded into memory by the application controller. Settings are stored in an XML file named config.xml.cfm within the config directory.

On the configuration document, all settings must be declared as children of the < settings > tag, which itself is a child tag of the document root: < config >.

Each setting must be defined as a string and declared in the following manner:

< setting name="sampleSetting" value="some_value" / >

Where name and value are respectively the name and value of the setting. All settings are loaded into a structure within the application scope. Event handlers may access these settings by using the function getSetting() passing the appropriate setting name.

The controller loads the settings only when the application is started, right before calling the onApplicationStart method in ehGeneral.cfc. To force a reload of the settings, use the resetApp flag with a value of true or 1. For example the following request will reset the application and force a reload of the settings.

index.cfm?resetApp=1

Please note that these kinds of settings are independent from the internal configuration of the framework and the use of this feature is optional.

 

Overview  |  Controller  |  Event Handlers  |  Views  |  Layouts  |  Services  |  Settings  |  Modules

BlogCFC was created by Raymond Camden. This blog is running version 5.9. Contact Blog Owner