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

From ADF Docs
Jump to: navigation, search
m (Reverted edits by Ecaxabu (Talk) to last revision by Rwest)
 
Line 1: Line 1:
----
 
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
 
----
 
=[http://esinyqynyso.co.cc Under Construction! Please Visit Reserve Page. Page Will Be Available Shortly]=
 
----
 
=[http://esinyqynyso.co.cc CLICK HERE]=
 
----
 
</div>
 
 
== Overview ==
 
== 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| 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.
 
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.
  
 
== Example Site Level Configuration for your App ==
 
== 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 &quot;twitter&quot;.  The application folder is located in /ADF/apps/twitter/ and contains various scripts/components and Custom Elements.
+
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.
 
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.
Line 21: Line 13:
 
# Place the following code in your twitter.xml file:
 
# Place the following code in your twitter.xml file:
  
&lt;pre&gt;
+
<pre>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
+
<?xml version="1.0" encoding="utf-8"?>
&lt;settings&gt;
+
<settings>
   &lt;apiLimit&gt;150&lt;/apiLimit&gt;
+
   <apiLimit>150</apiLimit>
   &lt;retweetStyle&gt;Old&lt;/retweet&gt;
+
   <retweetStyle>Old</retweet>
&lt;/settings&gt;
+
</settings>
&lt;/pre&gt;
+
</pre>
  
 
=== Using site config variables ===
 
=== Using site config variables ===
By default your Sites &quot;App.cfc&quot; (located in the /ADF/apps/myApp/components/ directory) contains a method (by virtue of extending AppBase.cfc (located in the /ADF/core/ directory) called &quot;getAppConfig()&quot;.  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:
+
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]]
 
[[File:Site_config_struct.png]]

Latest revision as of 17:41, 24 November 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