Difference between revisions of "Application Configuration at the Site Level (XML)"

From ADF Docs
Jump to: navigation, search
Line 1: Line 1:
== Application Site Configuration ==
+
== Overview ==
See the[[Custom Application Site Level Configuration|Custom Application Site Level Configuration]] wiki page for more details.
+
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| 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.
  
Following are the steps to set up a site configuration for an ADF application:
+
== 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.
 
# Locate the ''_cs_apps'' directory in your site.
 
# If the ''_cs_apps/config'' directory does not exist, create it.
 
# If the ''_cs_apps/config'' directory does not exist, create it.
# Identify the ADF applications sample XML configuration file. Update the file with the site information.
+
# Create a file called twitter.xml
# Ensure the file name is the ADF application nameFor example, with the Profile Application the XML config file name is ''ptProfile.xml''.
+
# Place the following code in your twitter.xml file:
# Place the XML config file into the ''_cs_apps/config'' directory.
+
 
 +
<pre>
 +
<?xml version="1.0" encoding="utf-8"?>
 +
<settings>
 +
  <apiLimit>150</apiLimit>
 +
  <retweetStyle>Old</retweet>
 +
</settings>
 +
</pre>
 +
 
 +
=== 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:
 +
 
 +
[[File:Site_config_struct.png]]
  
 
== Related Guides ==
 
== Related Guides ==

Revision as of 01:35, 8 March 2010

Overview

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

  1. Locate the _cs_apps directory in your site.
  2. If the _cs_apps/config directory does not exist, create it.
  3. Create a file called twitter.xml
  4. 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:

Site config struct.png

Related Guides