Posted By

_mantra on 07/01/10


Tagged

ColdFusion CFC


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

nehringryan
digitaloffice


create a ColdFusion Component (CFC)


 / Published in: ColdFusion
 

create a basic ColdFusion Component and return a value. This will return a string value based on a string parameter passed into it

  1. <cfcomponent output="false">
  2.  
  3. <cffunction name="myMethod" output="false" returntype="string" access="public">
  4. <cfargument name="myArg" required="false" type="string">
  5.  
  6. <cfset var myString = "This is my string " & #myArg# & "was passed to my CFC" >
  7.  
  8. <cfreturn myString>
  9.  
  10. </cfcomponent>
  11.  
  12.  
  13. You can implement the following CFC as follows:
  14.  
  15. <cfinvoke component="myCFC" method="myMethod" myArg="myValue" returnvariable="myResult">
  16.  
  17. <cfoutput>
  18. #myResult#
  19. </cfoutput>

Report this snippet  

You need to login to post a comment.