Content deleted Content added
m →ColdFusion Components (CFCs): {{tag}} |
|||
(48 intermediate revisions by 35 users not shown) | |||
Line 1:
{{Short description|Scripting language for web development}}
{{redirect|CFML|
{{Infobox programming language
| name
| logo
| paradigm
| year = {{Start date and age|1995}}▼
| developer
▲| designer = [[Jeremy Allaire]]
▲| developer = [[Adobe Systems]] ([[ColdFusion]]), Lucee Association ([[Lucee]]), [[New Atlanta]] and aw2.0 ([[openBD]]), The Railo Company ([[Railo]])
| latest release version = 2023 Release
| latest release date = {{Start date and age|2023}}
| latest preview version =
|
| typing
| implementations
| dialects
▲| file ext = .cfm, .cfc
▲| programming language = [[Java (programming language)|Java]]
| license
▲| operating system = [[Cross-platform]]
▲| license = Depends on the implementation. [[Proprietary software|Proprietary]], [[LGPL]], and [[GPL]]-licensed engines are all available.
| influenced by =
▲| website = {{URL|http://www.adobe.com/products/coldfusion}}
| influenced
}}
'''ColdFusion Markup Language''', more commonly known as '''CFML''', is a [[server-side scripting|scripting language]] for web development that runs on the [[
== Synopsis ==
In its simplest form, like many other web scripting languages, CFML augments standard [[HTML]] files with [[database]] commands, conditional [[Operator (programming)|operators]], high-level formatting [[function (computer science)|functions]], and other elements to produce [[web applications]].<ref>[http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_g-h_09.html Adobe ColdFusion 8 – About Internet applications and web application servers] {{Webarchive|url=https://web.archive.org/web/20120513034624/http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_g-h_09.html |date=2012-05-13}}. Livedocs.adobe.com. Retrieved on 2013-09-17.</ref><ref>[http://openbd.org/manual Open BlueDragon Manual]. Openbd.org. Retrieved on 2013-09-17.</ref> CFML also includes
CFML can be written using either tags or [[CFScript]], which resembles [[JavaScript]]
The pages in a CFML [[Application software|application]] include the [[server-side]] CFML tags and functions in addition to HTML tags
CFML can also be used to generate other languages, aside from HTML, such as [[XML]], [[JavaScript]], [[CSS]], and so on.
Line 37:
Despite the name, CFML is ''not'' a markup language. It is also not [[SGML]], since certain core CFML features prevent it from complying.
The CFML engine is configured in such a way that certain file extensions on the server (.cfm, .cfc) are handed off to the CFML engine for processing. In the case of the Java-based engines this is accomplished via [[Java servlet]]s. The CFML engine only processes CFML tags and functions; it returns text outside of CFML tags and functions to the [[web server]] unchanged.<ref>[http://livedocs.adobe.com/coldfusion/6.1/htmldocs/element4.htm Tags] {{webarchive |url=https://web.archive.org/web/20080324005624/http://livedocs.adobe.com/coldfusion/6.1/htmldocs/element4.htm |date=March 24, 2008
== History ==
Named Cold Fusion at the outset, the software was created in 1995 by the [[Allaire Corporation]], originally located in [[Minnesota]]. It later moved to Cambridge, Massachusetts and then finally to Newton, Massachusetts before being acquired by [[Macromedia]] in 2001. Allaire Cold Fusion thus became Macromedia Cold Fusion.
In 1998 Alan Williamson and his Scottish company, "n-ary", began creating a templating engine for Java to simplify common programming tasks.<ref>[https://web.archive.org/web/20100917122859/http://alan.blog-city.com/interview_alanwilliamson.htm Open BlueDragon Steering Committee Interview Series – Alan Williamson]. alan.blog-city.com</ref> Williamson was using curly-brace notation instead of tags, but when he saw an example of CFML and how it was solving similar problems (although not in Java) using a tag syntax, he started developing what would eventually become BlueDragon, which was the first Java implementation of the CFML language. (ColdFusion was written in [[C (programming language)|C]] and [[C++]] until version 6.0
The Railo CFML engine began as a student project in 2002 and was first launched as a commercial project in 2005.<ref>[http://www.getrailo.org/index.cfm/about-railo/ About Railo] {{Webarchive|url=https://web.archive.org/web/20110630010231/http://www.getrailo.org/index.cfm/about-railo/ |date=2011-06-30}}. Getrailo.org. Retrieved on 2013-09-17.</ref> Railo announced they were making the engine open source in 2008, and the first open source version was released in 2009.
On June 18, 2009, [[Adobe Systems|Adobe]] announced at the CFUnited conference that it had formed a CFML Advisory Committee<ref>http://corfield.org/entry/CFML_Advisory_Committee {{Webarchive|url=https://web.archive.org/web/20090107042428/http://corfield.org/entry/CFML_Advisory_Committee |date=2009-01-07}} CFML Advisory Committee
In 2012, the OpenCFML Foundation was launched. Its function is to push [[open-source software|open-source]] CFML applications and platforms.
In 2025, CFML was still in use. Lucee will hold a CFML conference, CFCAMP, on May 22-23, 2025.<ref>{{Cite web |last=Spitzer |first=Zac |date=April 1, 2025 |title=CFCAMP 2025, May 22nd & 23rd, Munich, Germany |url=https://dev.lucee.org/t/cfcamp-2025-may-22nd-23rd-munich-germany/14926 |access-date=April 22, 2025}}</ref> The Adobe ColdFusion Summit 2025 is to be held September 21-24, 2025.<ref>{{Cite web |date=April 22, 2025 |title=Adobe ColdFusion Summit 2025 |url=https://cfsummit.adobeevents.com/ |access-date=April 22, 2025}}</ref>
== Syntax ==
CFML tags have a similar format to HTML tags. They are enclosed in [[angle brackets]] (< and >) and generally have zero or more named [[attribute (computing)|attributes]], though some tags (e.g. cfset, cfif) contain an expression rather than attributes. Many CFML tags have bodies; that is, they have beginning and end tags with text to be processed between them. For example:
<
<cfoutput>
#value# Bob!
</cfoutput> </
Other tags, such as cfset and cfftp, never have bodies; all the required information goes between the beginning (<) character and the ending (>) character in the form of tag attributes (name/value pairs), as in the example below. If it is legal for tags not to have a body, it is syntactically acceptable to leave them unclosed as in the first example, though many CFML developers choose to self-close tags as in the second example to (arguably) make the code more legible.
<
<cfset value = "Hello">
<cfset value = "Hello" />
</syntaxhighlight>
Even if the tag can have a body, including a body may not be necessary in some instances because the attributes specify all the required information. In these cases, as with the second example above, the end tag (and hence, the tag body) may be omitted and the tag may be self-closing as in the following example:<ref>[http://livedocs.adobe.com/coldfusion/6.1/htmldocs/element5.htm Tag syntax] {{webarchive |url=https://web.archive.org/web/20080527095947/http://livedocs.adobe.com/coldfusion/6.1/htmldocs/element5.htm |date=May 27, 2008
<
<cfexecute name="C:\\winNT\\System32\\netstat.exe" arguments="-e" outputfile="C:\\Temp\\out.txt" timeout="1" /></
Various tags offer the ability to type-check input parameters (e.g. cffunction, cfparam, cfqueryparam) if the [[programmer]] declares their type specifically. This functionality is used with cfqueryparam to [[information security|secure]] web applications and databases from [[hacker (computer security)|hacker]]s and malicious web requests such as [[SQL injection]].
== Built-in tags ==
Nearly 100 tags and many more functions make up the heart of the CFML language. The following lists CFML tags by their function or purpose.<ref>[http://livedocs.adobe.com/coldfusion/8/cf8_cfml_ref.pdf Tags by function] {{Webarchive|url=https://web.archive.org/web/20080509064817/http://livedocs.adobe.com/coldfusion/8/cf8_cfml_ref.pdf |date=2008-05-09}}. (PDF)
*Application framework
*Communications
*Control
**[[Flow control construct|Flow-control]]
**Database manipulation
**[[Exception handling]]
Line 83 ⟶ 85:
*[[File management]]
*[[Form (web)|form]]
*[[Internet
*Page processing
*[[Security]]
Line 97 ⟶ 99:
For example, if writing a custom tag to perform [[addition]], taking two attributes and adding them together, the tag would be an addition.cfm file which could look like this:
<
<cfset caller.addition = attributes.first + attributes.second />
<cfexit method="exitTag" />
</syntaxhighlight>
Assuming the tag is in the same directory as the file (or in a pre-defined customtags directory), it can be invoked thus:
<
<cf_addition first="1" second="2">
</syntaxhighlight>
CFX tags are custom tags which are developed using [[Java language|Java]] or [[C++]], and are prefixed with cfx_ just like cf_. Java and C++ tags are added to the CFML runtime environment using the CFML engine's administrator or by editing configuration files.
Line 115 ⟶ 117:
{| class="wikitable sortable"
|-
!Function
!Reference
!Code
|-
|[[Array data structure|Array]]
|<ref>[http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_03.html#3473387 Array functions] {{Webarchive|url=https://web.archive.org/web/20081210235527/http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_03.html#3473387 |date=2008-12-10}}. Livedocs.adobe.com. Retrieved on 2013-09-17.</ref> ||(ArraySort, ArrayAppend, ArrayDeleteAt...)
|-
|Conversion
|<ref>[http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_04.html#1098761 Conversion functions] {{Webarchive|url=https://web.archive.org/web/20081208084545/http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_04.html#1098761 |date=2008-12-08}}. Livedocs.adobe.com. Retrieved on 2013-09-17.</ref> || (URLEncodedFormat, ToString...)
|-
|Date and time
|<ref>[http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_05.html#1098968 Date and time functions] {{Webarchive|url=https://web.archive.org/web/20081202132915/http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_05.html#1098968 |date=2008-12-02}}. Livedocs.adobe.com. Retrieved on 2013-09-17.</ref> || (LsTimeFormat, DateAdd, DateDiff...)
|-
|Decision
|<ref>[http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_06.html#3485787 Decision functions] {{Webarchive|url=https://web.archive.org/web/20090201085009/http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_06.html#3485787 |date=2009-02-01}}. Livedocs.adobe.com. Retrieved on 2013-09-17.</ref> || (IsDefined, IIF...)
|-
|Display and formatting
|<ref>[http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_07.html#1099219 Display and formatting functions] {{Webarchive|url=https://web.archive.org/web/20081220025858/http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_07.html#1099219 |date=2008-12-20}}. Livedocs.adobe.com. Retrieved on 2013-09-17.</ref> || (CJustify, NumberFormat...)
|-
|Dynamic evaluation
|<ref>[http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_08.html#1099242 Dynamic evaluation functions] {{Webarchive|url=https://web.archive.org/web/20081207195449/http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_08.html#1099242 |date=2008-12-07}}. Livedocs.adobe.com. Retrieved on 2013-09-17.</ref> || (DE, Evaluate...)
|-
|Extensibility
|<ref>[http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_09.html#3490127 Extensibility] {{Webarchive|url=https://web.archive.org/web/20090214041738/http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_09.html#3490127 |date=2009-02-14}}. Livedocs.adobe.com. Retrieved on 2013-09-17.</ref> || (CreateObject, ToScript...)
|-
|[[Image]]
|<ref>[http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_11.html#1099325 Image functions] {{Webarchive|url=https://web.archive.org/web/20090131150931/http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_11.html#1099325 |date=2009-01-31}}. Livedocs.adobe.com. Retrieved on 2013-09-17.</ref> || (ImageRotate, ImageAddBorder...)
|-
|International functions
|<ref>[http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_12.html#3614227 International functions] {{Webarchive|url=https://web.archive.org/web/20090208230052/http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_12.html#3614227 |date=2009-02-08}}. Livedocs.adobe.com. Retrieved on 2013-09-17.</ref> || (SetLocale, GetTimeZoneInfo...)
|-
|[[List (computing)|List]]
|<ref>[http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_13.html#1099435 List functions] {{Webarchive|url=https://web.archive.org/web/20081210235531/http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_13.html#1099435 |date=2008-12-10}}. Livedocs.adobe.com. Retrieved on 2013-09-17.</ref> || (FindOneOf, ListSetAt...)
|-
|Mathematical
|<ref>[http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_14.html#1099613 Mathematical functions] {{Webarchive|url=https://web.archive.org/web/20081207130216/http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_14.html#1099613 |date=2008-12-07}}. Livedocs.adobe.com. Retrieved on 2013-09-17.</ref> || (Randomize, Sqr...)
|-
|Other functions
|<ref>[http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_15.html#3493621 Other functions] {{Webarchive|url=https://web.archive.org/web/20090130043707/http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_15.html#3493621 |date=2009-01-30}}. Livedocs.adobe.com. Retrieved on 2013-09-17.</ref> || (WriteOutput, GetBaseTemplatePath...)
|-
|Query
|<ref>[http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_16.html#1099653 Query functions] {{Webarchive|url=https://web.archive.org/web/20090221144556/http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_16.html#1099653 |date=2009-02-21}}. Livedocs.adobe.com. Retrieved on 2013-09-17.</ref> || (QueryAddColumn, QuerySetCell...)
|-
|Security
|<ref>[http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_17.html#3542210 Security functions] {{Webarchive|url=https://web.archive.org/web/20081205034546/http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_17.html#3542210 |date=2008-12-05}}. Livedocs.adobe.com. Retrieved on 2013-09-17.</ref> || (Encrypt, Decrypt...)
|-
|[[String (computer science)|String]]
|<ref>[http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_18.html#1099887 String functions] {{Webarchive|url=https://web.archive.org/web/20090129213824/http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_18.html#1099887 |date=2009-01-29}}. Livedocs.adobe.com. Retrieved on 2013-09-17.</ref> || (Reverse, HTMLCodeFormat...)
|-
|[[Data structure|Structure]]
|<ref>[http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_19.html#1099964 Structure functions] {{Webarchive|url=https://web.archive.org/web/20090214023833/http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_19.html#1099964 |date=2009-02-14}}. Livedocs.adobe.com. Retrieved on 2013-09-17.</ref> || (StructKeyExists, StructDelete...)
|-
|[[System]]
|<ref>[http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_20.html#1100017 System functions] {{Webarchive|url=https://web.archive.org/web/20090201064841/http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_20.html#1100017 |date=2009-02-01}}. Livedocs.adobe.com. Retrieved on 2013-09-17.</ref> || (GetTickCount, GetTempFile...)
|-
|[[XML]]
|<ref>[http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_21.html#3468770 XML functions] {{Webarchive|url=https://web.archive.org/web/20090220221246/http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_21.html#3468770 |date=2009-02-20}}. Livedocs.adobe.com. Retrieved on 2013-09-17.</ref> || (XMLParse, GetSOAPResponse...)
|}
== ColdFusion Components (CFCs) ==
CFCs provide some (not all) of the typical features and functionality that are provided by [[Object-oriented programming|object-oriented]] (OOP) languages.
To create a CFC:
: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
<
<!--- temperature.cfc --->
<cfcomponent>
Line 205 ⟶ 207:
</cfinvoke>
<cfoutput>#fDegrees#°F = #result#°C</cfoutput> <br />
</syntaxhighlight>
CFCs may also be instantiated as objects. Assuming a CFC file called Person.cfc, an instance of this CFC would be instantiated as follows:
<
<cfset person = CreateObject("component", "Person") /></
CFCs also form the basis of the ability to create [[web services]] in CFML. A CFC is created in the usual way, and the attribute access="remote" added to any function within the CFC will make that function available to be called as a [[SOAP]]-based web service. The CFML engine auto-generates a [[Wsdl|WSDL]] and creates all the necessary stubs for the web service to function.
== Security updates ==
Adobe releases security patches for ColdFusion as needed, typically in response to identified vulnerabilities. These updates address critical issues such as [[arbitrary code execution]] and security feature bypasses. For instance, on December 23, 2024, Adobe released updates for ColdFusion 2023 and 2021 to resolve a critical vulnerability that could lead to arbitrary file system read.
To stay informed about the latest security updates, users should regularly check Adobe's official ColdFusion security bulletins. Additionally, subscribing to Adobe's security notification service ensures timely alerts about new patches and vulnerabilities. Implementing these updates promptly is crucial to maintaining the security and integrity of ColdFusion applications.
== References ==
Line 217 ⟶ 223:
==External links==
* [https://cfdocs.org/ CFML documentation maintained by the community
* [https://github.com/mhenke/CFML-in-100-minutes/blob/develop/cfml100mins.markdown CFML in 100 minutes — introduction to the basics of the CFML language.]
* [http://learncfinaweek.com/ A community driven training program that teaches the basics of CFML.]
* [http://cfml-slack.herokuapp.com/ CFML Slack team]
* [http://www.cfquickdocs.com/ CFQuickDocs — ColdFusion tags and functions reference.]
* [http://lucee.org/ Lucee]
* [http://openbd.org/ Open BlueDragon]
* [http://www.newatlanta.com/products/bluedragon/product_info/overview.cfm BlueDragon]
* [http://getrailo.com/ Railo]
* [https://groups.google.com/group/cfml-conventional-wisdom CFML Conventional Wisdom Google Group]
* [https://web.archive.org/web/20090204105406/http://www.opencfml.org/ CFML Advisory Committee] (this committee is now defunct)
{{CFML programming language}}
[[Category:CFML programming language]]
[[Category:Domain-specific programming languages]]
|