ColdFusion Markup Language
   HOME

TheInfoList



OR:

ColdFusion Markup Language, more commonly known as CFML, is a
scripting language A scripting language or script language is a programming language that is used to manipulate, customize, and automate the facilities of an existing system. Scripting languages are usually interpreted at runtime rather than compiled. A scripting ...
for web development that runs on the
JVM A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally describes ...
, the
.NET framework The .NET Framework (pronounced as "''dot net"'') is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until bein ...
, and
Google App Engine Google App Engine (often referred to as GAE or simply App Engine) is a cloud computing platform as a service for developing and hosting web applications in Google-managed data centers. Applications are sandboxed and run across multiple servers ...
. Multiple commercial and
open source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized so ...
implementations of CFML engines are available, including
Adobe ColdFusion Adobe ColdFusion is a commercial rapid web-application development computing platform created by J. J. Allaire in 1995. (The programming language used with that platform is also commonly called ColdFusion, though is more accurately known as C ...
,
Lucee Lucee is an open source implementation of a lightweight dynamically-typed scripting language for the Java virtual machine (JVM). The language is used for rapid development of web applications that compile directly to Java bytecode, and is comp ...
,
New Atlanta New Atlanta Communications, LLC is a software company specializing in products to ease creation of Web applications. Based in Alpharetta, Georgia Alpharetta is a city in northern Fulton County, Georgia, United States, and is a part of the Atlant ...
BlueDragon BlueDragon is a ColdFusion Markup Language (CFML) engine comparable to Adobe Systems's ColdFusion. It is licensed and distributed by New Atlanta from TagServlet Ltd based in Scotland. BlueDragon is also distributed and supported by BEA Systems ...
(who offer both a Java-based and a .NET-based version),
Railo Railo Server, commonly referred to as Railo ( ), is open source software which implements the general-purpose CFML server-side scripting language, often used to create dynamic websites, web applications and intranet systems. CFML is a dynami ...
, and
Open BlueDragon BlueDragon is a ColdFusion Markup Language (CFML) engine comparable to Adobe Systems's ColdFusion. It is licensed and distributed by New Atlanta from TagServlet Ltd based in Scotland. BlueDragon is also distributed and supported by BEA Systems ...
as well as other CFML server engines.


Synopsis

In its simplest form, like many other web scripting languages, CFML augments standard
HTML The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaS ...
files with
database In computing, a database is an organized collection of data stored and accessed electronically. Small databases can be stored on a file system, while large databases are hosted on computer clusters or cloud storage. The design of databases ...
commands, conditional
operators Operator may refer to: Mathematics * A symbol indicating a mathematical operation * Logical operator or logical connective in mathematical logic * Operator (mathematics), mapping that acts on elements of a space to produce elements of another sp ...
, high-level formatting functions, and other elements to produce
web applications A web application (or web app) is application software that is accessed using a web browser. Web applications are delivered on the World Wide Web to users with an active network connection. History In earlier computing models like client-serv ...
. CFML also includes numerous other constructs including ColdFusion Components (CFCs), CFML's version of
objects Object may refer to: General meanings * Object (philosophy), a thing, being, or concept ** Object (abstract), an object which does not exist at any particular time or place ** Physical object, an identifiable collection of matter * Goal, an ai ...
, that allow for separation of business logic from presentation. CFML can be written using either tags or
CFScript CFScript is an extension of CFML on the ColdFusion platform. CFScript resembles JavaScript. Some ColdFusion developers prefer it since it has less visual and typographical overhead than ordinary CFML. Usage Unless it's within a pure script-ba ...
, which resembles
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, of ...
(
ECMA script ECMAScript (; ES) is a JavaScript standard intended to ensure the interoperability of web pages across different browsers. It is standardized by Ecma International in the documenECMA-262 ECMAScript is commonly used for client-side scripting ...
). The pages in a CFML
application Application may refer to: Mathematics and computing * Application software, computer software designed to help the user to perform specific tasks ** Application layer, an abstraction layer that specifies protocols and interface methods used in a c ...
include the
server-side In the client–server model, server-side refers to programs and operations that run on the server. This is in contrast to client-side programs and operations which run on the client. General concepts Typically, a server is a computer applicati ...
CFML tags and functions in addition to HTML tags. Modern CFML applications also tend to have CFCs that are accessed by the CFML pages for executing business logic. When a
web browser A web browser is application software for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's screen. Browsers are used o ...
requests a page in a ColdFusion application, it is automatically pre-processed by the ColdFusion
application server An application server is a server that hosts applications or software that delivers a business application through a communication protocol. An application server framework is a service layer model. It includes software components available to a ...
. CFML can also be used to generate other languages, aside from HTML, such as
XML Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. T ...
,
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, of ...
,
CSS Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a document written in a markup language such as HTML or XML (including XML dialects such as SVG, MathML or XHTML). CSS is a cornerstone technolo ...
, and so on. Despite the name, CFML is ''not'' a markup language. It is also not
SGML The Standard Generalized Markup Language (SGML; ISO 8879:1986) is a standard for defining generalized markup languages for documents. ISO 8879 Annex A.1 states that generalized markup is "based on two postulates": * Declarative: Markup should ...
, 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 A Jakarta Servlet (formerly Java Servlet) is a Java software component that extends the capabilities of a server. Although servlets can respond to many types of requests, they most commonly implement web containers for hosting web applicati ...
s. The CFML engine only processes CFML tags and functions; it returns text outside of CFML tags and functions to the web server unchanged.


History

Named Cold Fusion at the outset, the software was created in 1995 by the
Allaire Corporation Allaire Corporation was a computer software company founded by Jeremy and JJ Allaire in Minnesota, later headquartered in Cambridge, then Newton, Massachusetts. It commenced operations in May 1995, had its initial public offering on NASDAQ (tr ...
, originally located in
Minnesota Minnesota () is a state in the upper midwestern region of the United States. It is the 12th largest U.S. state in area and the 22nd most populous, with over 5.75 million residents. Minnesota is home to western prairies, now given over t ...
. It later moved to Cambridge, Massachusetts and then finally to Newton, Massachusetts before being acquired by
Macromedia Macromedia, Inc., was an American graphics, multimedia, and web development software company (1992–2005) headquartered in San Francisco, California, that made products such as Flash and Dreamweaver. It was purchased by its rival Adobe System ...
in 2001. Allaire Cold Fusion thus became Macromedia Cold Fusion. At the release of version 4, the space in the name was removed to become ColdFusion. Adobe acquired Macromedia in 2005 and is still actively developing ColdFusion. In 1998 Alan Williamson and his Scottish company, "n-ary", began creating a templating engine for Java to simplify common programming tasks. 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 and C++ until version 6.0 — the first Java-based version of ColdFusion — was released in 2002.) New Atlanta licensed BlueDragon around 2001 and made it available as a commercial product, eventually creating a .NET implementation of CFML. Open BlueDragon is a fork of the commercial BlueDragon product and was first released in 2008. The Railo CFML engine began as a student project in 2002 and was first launched as a commercial project in 2005. 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 Adobe ( ; ) is a building material made from earth and organic materials. is Spanish for '' mudbrick''. In some English-speaking regions of Spanish heritage, such as the Southwestern United States, the term is used to refer to any kind of ...
announced at the CFUnited conference that it had formed a CFML Advisory Committee that would be responsible for guiding and reviewing changes to the CFML language. This effort was disbanded in 2010. The Google Group CFML Conventional Wisdom was created as a forum for open, public discussions about language and engine features; its use has dwindled since 2011. In 2012, the OpenCFML Foundation was launched. Its function is to push
open-source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized so ...
CFML applications and platforms. Former Railo lead developer Michael Offner launched
Lucee Lucee is an open source implementation of a lightweight dynamically-typed scripting language for the Java virtual machine (JVM). The language is used for rapid development of web applications that compile directly to Java bytecode, and is comp ...
, a fork of
Railo Railo Server, commonly referred to as Railo ( ), is open source software which implements the general-purpose CFML server-side scripting language, often used to create dynamic websites, web applications and intranet systems. CFML is a dynami ...
, in London on January 29, 2015. Backed by community supporters and members of the Lucee Association, the goal of the project is to provide the functionality of CFML using fewer resources, giving better performance and to move CFML past its roots and into a modern and dynamic Web programming platform.


Syntax

CFML tags have a similar format to HTML tags. They are enclosed in
angle brackets A bracket is either of two tall fore- or back-facing punctuation marks commonly used to isolate a segment of text or data from its surroundings. Typically deployed in symmetric pairs, an individual bracket may be identified as a 'left' or 'r ...
(< and >) and generally have zero or more named 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: #value# Bob! 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. 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: Various tags offer the ability to type-check input parameters (e.g. cffunction, cfparam, cfqueryparam) if the
programmer A computer programmer, sometimes referred to as a software developer, a software engineer, a programmer or a coder, is a person who creates computer programs — often for larger computer software. A programmer is someone who writes/creates ...
declares their type specifically. This functionality is used with cfqueryparam to
secure Secure may refer to: * Security, being protected against danger or loss(es) ** Physical security, security measures that are designed to deny unauthorized access to facilities, equipment, and resources **Information security, defending information ...
web applications and databases from
hacker A hacker is a person skilled in information technology who uses their technical knowledge to achieve a goal or overcome an obstacle, within a computerized system by non-standard means. Though the term ''hacker'' has become associated in popu ...
s and malicious web requests such as
SQL injection In computing, SQL injection is a code injection technique used to attack data-driven applications, in which malicious SQL statements are inserted into an entry field for execution (e.g. to dump the database contents to the attacker). SQL in ...
.


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. *Application framework *Communications *Control **Flow-control **Database manipulation **
Exception handling In computing and computer programming, exception handling is the process of responding to the occurrence of ''exceptions'' – anomalous or exceptional conditions requiring special processing – during the execution of a program. In general, an ...
*Data output *
Debugging In computer programming and software development, debugging is the process of finding and resolving '' bugs'' (defects or problems that prevent correct operation) within computer programs, software, or systems. Debugging tactics can involve i ...
*Display management *Extensibility *
File management A file manager or file browser is a computer program that provides a user interface to manage files and folders. The most common operations performed on files or groups of files include creating, opening (e.g. viewing, playing, editing or p ...
*
form Form is the shape, visual appearance, or configuration of an object. In a wider sense, the form is the way something happens. Form also refers to: *Form (document), a document (printed or electronic) with spaces in which to write or enter data * ...
*
Internet protocol The Internet Protocol (IP) is the network layer communications protocol in the Internet protocol suite for relaying datagrams across network boundaries. Its routing function enables internetworking, and essentially establishes the Internet. ...
*Page processing *
Security" \n\n\nsecurity.txt is a proposed standard for websites' security information that is meant to allow security researchers to easily report security vulnerabilities. The standard prescribes a text file called \"security.txt\" in the well known locat ...
* Variable manipulation *Other tags (cfimage, cfregistry etc.)


Custom tags

CFML allows language extensions in the form of custom tags, which are tags created by the developer that are not part of the CFML language itself. Custom tags are regular CFML files which are intended to be invoked as tags, although it is possible to treat a
template Template may refer to: Tools * Die (manufacturing), used to cut or shape material * Mold, in a molding process * Stencil, a pattern or overlay used in graphic arts (drawing, painting, etc.) and sewing to replicate letters, shapes or designs ...
as both a custom tag and a regular template. Custom tags are written in CFML and are typically invoked by prefixing the custom tag's file name with ''cf_'', although there are other ways to invoke custom tags. If a template is invoked as a custom tag, the attributes used to invoke that tag are available within the tag in an ''attributes'' scope and the variables for the calling page are accessible via the ''caller'' scope. For example, if writing a custom tag to perform
addition Addition (usually signified by the plus symbol ) is one of the four basic operations of arithmetic, the other three being subtraction, multiplication and division. The addition of two whole numbers results in the total amount or '' sum'' ...
, taking two attributes and adding them together, the tag would be an addition.cfm file which could look like this: Assuming the tag is in the same directory as the file (or in a pre-defined customtags directory), it can be invoked thus: CFX tags are custom tags which are developed using
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mo ...
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. On some CFML engines JSP tags can also be included in CFML pages using the tag.


Functions

ColdFusion Markup Language includes a set of functions that you use to perform logical and arithmetic operations and manipulate data.


ColdFusion Components (CFCs)

CFCs provide some (not all) of the typical features and functionality that are provided by
object-oriented Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of ...
(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 An argument is a statement or group of statements called premises intended to determine the degree of truth or acceptability of another statement called conclusion. Arguments can be studied from three main perspectives: the logical, the dialectic ...
, and return a value. ::: Defines a CFC ::: Defines the functions (methods) within a CFC ::: Defines the arguments (parameters) that a function accepts ::: Returns a value or result from a function 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 tag will create an instance of the CFC, invoke the desired method, and then destroy the instance of the CFC. takes the name of the component (minus the .cfc extension) and the method to execute. To access any returned data, the RETURNVARIABLE attribute provides the name of a variable to contain whatever the function returns. CFCs are created using four tags, saved as .CFC files, and invoked using the tag.Forta, Be
Using ColdFusion components
adobe.com
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. #fDegrees#°F = #result#°C
CFCs may also be instantiated as objects. Assuming a CFC file called Person.cfc, an instance of this CFC would be instantiated as follows: 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 Soap is a salt of a fatty acid used in a variety of cleansing and lubricating products. In a domestic setting, soaps are surfactants usually used for washing, bathing, and other types of housekeeping. In industrial settings, soaps are us ...
-based web service. The CFML engine auto-generates a WSDL and creates all the necessary stubs for the web service to function.


References


External links


CFML documentation maintained by the community.

CFML in 100 minutes — introduction to the basics of the CFML language.

A community driven training program that teaches the basics of CFML.

CFML Slack team

CFQuickDocs — ColdFusion tags and functions reference.

Lucee

Open BlueDragon

BlueDragon

Railo

CFML Conventional Wisdom Google Group

CFML Advisory Committee
(this committee is now defunct) {{CFML programming language CFML programming language Domain-specific programming languages