Core CFML Language

The core elements of the CFML Language.

CFML started as a tag based language and then introduced <cfscript>.

So keep in mind, all these tags, i.e <cfif> can be also used in <cfscript>, which is similar to JavaScript.

// tag
<cfif redirect>
    <cflocation url="https://www.lucee.org">
</cfif>

// cfscript if (redirect) location url="https://www.lucee.org"; // or location(url="https://www.lucee.org"); }

// tags <cfloop from=1 to=10 item="i"> <cfoutput>#i#</cfoutput> </cfloop>

// cfscript loop from=1 to=10 item="i" { echo(i); }

Functions

  • CreateGUID() Creates a Globally Unique Identifier (GUID). A GUID is a 36-character string representation of a unique 128-bit integer xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx where x is a hexadecimal digit. A GUID is just a UUID with one extra dash.
  • CreateObject() The CreateObject function takes different arguments depending on the value of the first argument:
  • CreateULID() Generates a ULID (Universally Unique Lexicographically Sortable Identifier)
  • CreateUUID() Creates a Universally Unique Identifier (UUID). A UUID is a 35-character string representation of a unique 128-bit integer xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx where x is a hexadecimal digit.
  • GetCurrentTemplatePath() Gets the absolute path of the page that calls this function.
  • Len() Determines the length of a string, array or struct

Tags

  • <cfabort> **Stops processing of a page at the tag location.** CFML returns everything that was processed before the cfabort tag. The cfabort tag is often used with conditional logic to stop processing a page when a condition occurs.
  • <cfcatch> Used only inside a cftry, the cfcatch tag catches and process exceptions.
  • <cfcomponent> Creates and defines a component object
  • <cfcontent> Defines the MIME type returned by the current page. Optionally, lets you specify the name of a file to be returned with the page.
  • <cfdirectory> Handles interactions with directories.
  • <cfdump> Outputs the elements, variables and values of most kinds of CFML objects. Useful for debugging. You can display the contents of simple and complex variables, objects, components, user-defined functions, and other elements.
  • <cfelse> Used with cfelse and cfelseif, cfif lets you create simple and compound conditional statements in CFML. The value in the cfif tag can be any expression.
  • <cfelseif> Used with cfelse and cfelseif, cfif lets you create simple and compound conditional statements in CFML. The value in the cfif tag can be any expression.
  • <cfexecute> Enables developers to execute a process on a server computer.
  • <cffile> Handles all interactions with files
  • <cffunction> Defines a function within a CFML component that can accept arguments and return a value.
  • <cfheader> Generates custom HTTP response headers to return to the client.
  • <cfhttp> Lets you execute HTTP POST and GET operations on files.
  • <cfif> Used with cfelse and cfelseif, cfif lets you create simple and compound conditional statements in CFML. The value in the cfif tag can be any expression.
  • <cfinclude> Lets you embed references to pages in CFML. You can embed cfinclude tags recursively. For an additional method of encapsulating CFML
  • <cflocation> Redirect the current request to another URL.
  • <cflock> Provides two types of locks to ensure the integrity of shared data: Exclusive lock and Read-only lock.
  • <cfloop> Looping is a very powerful programming technique that lets you repeat a set of instructions or display output repeatedly until one or more conditions are met. cfloop supports five types of loops.
  • <cfmail> Sends e-mail messages by an SMTP server.
  • <cfmodule> Invokes a custom tag for use in cfml templates. The cfmodule tag can help deal with custom tag name conflicts. Use the template attribute to name a template that contains the custom tag definition, including its path..
  • <cfoutput> Displays the results of a database query or other operation. To nest cfoutput tags, see the &quot;Usage&quot; section.
  • <cfparam> Tests for a parameter's existence, tests its data type, and provides a default value if one is not assigned.
  • <cfquery> Passes SQL statements to a data source. Not limited to queries.
  • <cfreturn> Returns result values from a component method. Contains an expression returned as result of the function.
  • <cfsavecontent> Saves the generated content inside the tag body in a variable.
  • <cfscript> Encloses a code segment containing cfscript.
  • <cfset> Define a CFML variable. If the variable exists, cfset resets it to the specified value.
  • <cfswitch> Used with cfcase and cfdefaultcase. Evaluates a passed expression and passes control to the cfcase tag that matches the expression result. You can optionally code a cfdefaultcase tag, which receives control if there is no matching cfcase tag value.
  • <cftry> Used with one or more cfcatch tags, the cftry tag lets you catch and process exceptions in CFML pages.
  • Application.cfc / <cfapplication> Defines a CFML Application and configures the properties / behavior of that Application

Categories

Guides

  • Lucee Changelog, new Tags & Functions, Arguments and Attributes Here is a list of all the new Tags and Functions, Attributes and Arguments that have been added to Lucee over time
  • Lucee Language and Syntax Differences ## Architecture ## Adobe ColdFusion (ACF) is configured in a way that only one single web context is available for a server instance. This means that if you do not secure your single applications they might become vulnerable, you will have to use sandbox security, single instances, etc. This and the fact that you do not have the ability to configure individual CF settings for each virtual host are the major disadvantages of this setup
  • Operators Mathematical, Logical, Ternary, Comparison, String and Elvis Operators
  • Reserved Words The only reserved words in Lucee are null, true and false. scope names
  • Scopes local, arguments, query, variables, this, cgi, cffile, url, form, cookie, client, thread, caller, request