Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling functions between components in Coldfusion

Say I have a project, I have several CFC's in that project. For the sake of the example, I have a debugging function general.cfc and I want to use that function in mandrill.cfc without having to copy and paste the code into the latter cfc. I've googled this until I can google no more and I know I need to post it here.

Anyone care to take me to school?

like image 665
user2596576 Avatar asked Jan 19 '26 11:01

user2596576


1 Answers

This is how I would do it

<cfset var objGeneral = createObject("component","general")>

Then if you have a function in general.cfc called getName() you can call it by saying objGeneral.getName()

like image 77
Matt Busche Avatar answered Jan 22 '26 13:01

Matt Busche



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!