How do I use CFC's with ColdFusion MX?

The following article explains how to use CFC's with ColdFusion. A CFC (ColdFusion Component) is used to combine various functions and tags into a single object that is called from your code. CFC's are supported on HostMySite's ColdFusion Hosting plans.

To use the CFC, a ColdFusion mapping must first be created and then the CFC must be called using the cfinvoke tag. To create the cfmapping for your CFC, please follow the instructions in the article found here.

Once the mapping is created you can add the code for the cfinvoke tag into your pages.

Note: If the mapping does not point directly to the component file, you will need to specify the additional path in the cfinvoke tag.

The following syntax is an example of how to setup your CFC:

<cfinvoke component="mapping.component"

The following is an example using sample information:

  • mapping: livego
  • component: newsflash.cfc (Note, the file extension is dropped when called in the tag)
  • method: list
  • variable: news
<cfinvoke component="livego.newsflash"

For further information on cfinvoke for ColdFusion MX 7.0 you can view Macromedia's livedocs website here.


© 2015 HostMySite