How To instantiate a CFC


/ Published in: ColdFusion
Save to your folder(s)



Copy this code and paste it in your HTML
  1. -- Instantiating at a variable level
  2. <Cfset application.cfc.image = createObject("component", "#application.RPUBcfcpath#.image") />
  3.  
  4. -- Then call
  5. <cfoutput>
  6. #application.cfc.string.titleCase([argumentParam1], [argumentParam2])#
  7. </cfoutput>
  8.  
  9.  
  10. ------------------------------------------
  11.  
  12. -- Invoke the Application instantiated arguemnt using CFINVOKE
  13. <cfinvoke
  14. component="#application.cfc.getData#"
  15. method="getMODSimilarModelno"
  16. returnvariable="similarToMOD">
  17.  
  18. <cfinvokeargument
  19. name="modelno"
  20. value="#url.modelno#">
  21.  
  22. </cfinvoke>
  23.  
  24. ------------------------------------------
  25.  
  26. -- Invoke the component directly
  27. <cfinvoke
  28. component="nasdaq.quote"
  29. method="getLastTradePrice"
  30. returnVariable="res">
  31.  
  32. <cfinvokeargument
  33. name="symbol"
  34. value="macr">
  35.  
  36. </cfinvoke>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.