Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Thank you Charlie for replying. Can i create functions alone in a .cfc file without creating the cfcomponent?
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
No, I'm was thinking if I can create a cffuntion inside cfc file (without a cfcomponent). And one more doubt please. If I use cfinvoke to call a function in cfc and pass argumentCollection(#Form#) , how should I receive it in the cffunction? Should I create an cfargument for it inside the cffunction?