Skip to main content
Inspiring
July 8, 2023
Question

Please elaborate how many ways are there to call a CFC function from a .cfm page?

  • July 8, 2023
  • 1 reply
  • 1744 views

Hi,

 

Could you please elaborate  how many ways are there to call a CFC function from a .cfm page?  And I have one more doubt. Can I create a cfc function without creating a cfcomponent? Thank you.

    This topic has been closed for replies.

    1 reply

    Charlie Arehart
    Community Expert
    Community Expert
    July 8, 2023

    There are at least a few: cfobject and cfinvoke (and their cfscript equivalents), as well as the createObject function, and the new keyword.

     

    As for your last question, you can certainly create a function in a cfm (without a CFC) using the cffunction tag or script function statement. That could be called from that cfm or any that included that file. 

    /Charlie (troubleshooter, carehart. org)
    Inspiring
    July 8, 2023

    Thank you Charlie for replying. Can i create  functions alone in  a .cfc file without creating the cfcomponent?

    Charlie Arehart
    Community Expert
    Community Expert
    July 8, 2023

    Well, a CFC *IS* a cf component. Your questions are implying you have in mind either some challenge or something clever that you're considering. Can you please elaborate? 

    /Charlie (troubleshooter, carehart. org)