Application Configuration at the Site Level (XML)
Every ADF Application can have Site Level configuration file to help the application do special things depending on the settings/pages/templates within your site. For example, the Profile Application has several settings which allow the application to interact with various pages within your site. The settings at the site level allow more than one CommonSpot site on your server to act differently but use the same application code base.
Example Site Level Configuration for your App
Below is an example of how you could take advantage of an Site Level Configuration file within your application. For our example, we will create a fictitious application called "twitter". The application folder is located in /ADF/apps/twitter/ and contains various scripts/components and Custom Elements.
Lets say in your Twitter application you wanted to have various settings like API Limit and Retweet Style. By having these settings your application can be used in many sites and each site can have its own values.
Create config file
- Locate the _cs_apps directory in your site.
- If the _cs_apps/config directory does not exist, create it.
- Create a file called twitter.xml
- Place the following code in your twitter.xml file:
<?xml version="1.0" encoding="utf-8"?> <settings> <apiLimit>150</apiLimit> <retweetStyle>Old</retweet> </settings>
Using site config variables
By default your Sites "App.cfc" (located in the /ADF/apps/myApp/components/ directory) contains a method (by virtue of extending AppBase.cfc (located in the /ADF/core/ directory) called "getAppConfig()". This returns back the current sites configuration which is based on the values entered into the XML file (mentioned above). Calling that function would return a structure like this: