Application Configuration at the Site Level (Element)

From ADF Docs
Revision as of 20:32, 11 April 2010 by Rwest (talk | contribs) (Created page with '== Overview == Every ADF Application can have a Site Level configuration to help the application do special things depending on the settings/pages/templates within your site. For…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview

Every ADF Application can have a Site Level configuration 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 element

  • Create a Global Custom Element called "Twitter Configuration". Note: It is important to name the Custom Element using the following naming Convention:
 #AppName# Configuration

Where #AppName# is the value entered in the "appBeanName" variable in your applications App Bean Confg file.

  • Create any fields into this configuration element that you would like for the user to enter data into at the site level

For example, in the Twitter application example you would have the following fields: Twitter Configuration Element form.png


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:

Site config struct.png

Related Guides