Content deleted Content added
m Disambiguating links to Object-orientation (link changed to Object-oriented programming) using DisamAssist. |
m →ColdFusion Components (CFCs): {{tag}} |
||
Line 181:
:Create a file with a .CFC extension (this distinguishes CFCs from ColdFusion templates, which have a .CFM extension).
:Use four tags to create the components, define their functions and [[arguments]], and return a value.
:
:
:
:
CFCs are plain CFML. Within a CFC any CFML tag, function, custom tag, other components, etc. may be used.
CFCs can be used in various ways. If a method contained in a CFC simply needs to be invoked, the
CFCs are created using four tags, saved as .CFC files, and invoked using the
In the example below, component temperature.cfc has a method FtoC which converts temperature from Fahrenheit to Celsius. The test.cfm template invokes the method and converts 212 degrees Fahrenheit and outputs the result.
|