Skip to main content
Inspiring
Jul 8, 2023 5:46 PM UTC
Question

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

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 is closed to new replies. Start a new post to keep the conversation going.

    4 replies

    Charlie Arehart
    Community Expert
    Community Expert
    Jul 8, 2023 6:28 PM UTC

    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. 

    Translate
    /Charlie (troubleshooter, carehart. org)
    Inspiring
    Jul 8, 2023 6:50 PM UTC

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

    Translate
    Charlie Arehart
    Community Expert
    Community Expert
    Jul 8, 2023 7:44 PM UTC

    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? 

    Translate
    /Charlie (troubleshooter, carehart. org)