Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between cfc and cfm

I'm trying to create basically a library of UDFs (User Defined Functions) for a web site run in ColdFusion. While doing this I am trying to find out what the differences are between cfc and cfm files. Which would be more helpful in creating this library of functions? I know that I can use

<cfinclude template="mytemplate.cfm>

to include it in a page but that will run the entire contents of that cfm on that page every time. I don't know and easier way to use cfc other than to create an object of the cfc and call the function that way.

<cfobject type="component" action="create" name="test">

Any ideas?

like image 957
jkw4703 Avatar asked Sep 20 '25 12:09

jkw4703


1 Answers

The way that I do it is to create all my UDF in a cfc. I then initialize that cfc on application start:

public function onApplicationStart() {
    // Application settings
    application.util = createObject("component","cfc.util");
    return;
}
like image 157
Sollinger04 Avatar answered Sep 23 '25 05:09

Sollinger04