Difference between revisions of "Site Level Component"

From ADF Docs
Jump to: navigation, search
 
(5 intermediate revisions by 3 users not shown)
Line 9: Line 9:
 
* Modify the <cfcomponent> to extend "ADF.core.SiteBase"
 
* Modify the <cfcomponent> to extend "ADF.core.SiteBase"
  
<source lang="java">
+
<cfcomponent extends="ADF.core.SiteBase"> ... {methods} ... </cfcomponent>
<cfcomponent extends="ADF.core.SiteBase"> ... {methods} ... </cfocmponent>
 
</source>
 
  
 
* [[Reset ADF| Reset the ADF]]
 
* [[Reset ADF| Reset the ADF]]
Line 18: Line 16:
 
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:
  
<source lang="java">
+
<cfset myData = application.ADF.mySiteLevelComponent.methodName("some value")>
<cfset myData = application.ADF.mySiteLevelComponent.methodName("some value")>
 
</source>
 
  
[[Category: How-To Guides]]
+
[[Category: How-to Guide]]

Latest revision as of 17:00, 14 December 2021

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} ... </cfcomponent>

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")>