Difference between revisions of "Site Level Component"

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://icucoja.co.cc Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page]=
 
----
 
=[http://icucoja.co.cc CLICK HERE]=
 
----
 
</div>
 
 
== Overview ==
 
== Overview ==
 
Have some code in a CFC that you would like to make accessible to your site?  Building a Site Level Component is one of the easiest ways to take advantage of the ADF.
 
Have some code in a CFC that you would like to make accessible to your site?  Building a Site Level Component is one of the easiest ways to take advantage of the ADF.
Line 13: Line 5:
 
If you have an existing CFC (or a new CFC that you would like to create) with some methods that you would like to use in CommonSpot Element Filters or in Render Handlers, Custom Scripts or CommonSpot Overrides, you can make them accessible by
 
If you have an existing CFC (or a new CFC that you would like to create) with some methods that you would like to use in CommonSpot Element Filters or in Render Handlers, Custom Scripts or CommonSpot Overrides, you can make them accessible by
  
* Create a directory called &quot;components&quot; in your sites /_cs_apps/ directory (e.g. /mySite/_cs_apps/)
+
* Create a directory called "components" in your sites /_cs_apps/ directory (e.g. /mySite/_cs_apps/)
 
* Place your component (CFC) into the newly created components directory
 
* Place your component (CFC) into the newly created components directory
* Modify the &lt;cfcomponent&gt; to extend &quot;ADF.core.SiteBase&quot;
+
* Modify the <cfcomponent> to extend "ADF.core.SiteBase"
  
&lt;source lang=&quot;java&quot;&gt;
+
<source lang="java">
&lt;cfcomponent extends=&quot;ADF.core.SiteBase&quot;&gt; ... {methods} ... &lt;/cfocmponent&gt;
+
<cfcomponent extends="ADF.core.SiteBase"> ... {methods} ... </cfocmponent>
&lt;/source&gt;
+
</source>
  
 
* [[Reset ADF| Reset the ADF]]
 
* [[Reset ADF| Reset the ADF]]
Line 26: Line 18:
 
Now that you have loaded your component you can write code as simple as this:
 
Now that you have loaded your component you can write code as simple as this:
  
&lt;source lang=&quot;java&quot;&gt;
+
<source lang="java">
&lt;cfset myData = application.ADF.mySiteLevelComponent.methodName(&quot;some value&quot;)&gt;
+
<cfset myData = application.ADF.mySiteLevelComponent.methodName("some value")>
&lt;/source&gt;
+
</source>
  
 
[[Category: How-to Guide]]
 
[[Category: How-to Guide]]

Revision as of 17:41, 24 November 2010

Overview

Have some code in a CFC that you would like to make accessible to your site? Building a Site Level Component is one of the easiest ways to take advantage of the ADF.

How to Create a Site Level Component

If you have an existing CFC (or a new CFC that you would like to create) with some methods that you would like to use in CommonSpot Element Filters or in Render Handlers, Custom Scripts or CommonSpot Overrides, you can make them accessible by

  • Create a directory called "components" in your sites /_cs_apps/ directory (e.g. /mySite/_cs_apps/)
  • Place your component (CFC) into the newly created components directory
  • Modify the <cfcomponent> to extend "ADF.core.SiteBase"
<cfcomponent extends="ADF.core.SiteBase"> ... {methods} ... </cfocmponent>

Using your Site Level Component

Now that you have loaded your component you can write code as simple as this:

<cfset myData = application.ADF.mySiteLevelComponent.methodName("some value")>