Skip to content

Latest commit

 

History

History
70 lines (48 loc) · 1.85 KB

syntax.md

File metadata and controls

70 lines (48 loc) · 1.85 KB

Syntax

There are two flavors to the Lucee Language, Tags and Script. The entire language is available in Tags or Script. Tags are intended to mix well with HTML and should (almost always) only be used in HTML templates.

Quick Overview

Script

The script based language resembles javascript

{% gist id="roryl/5817942eccef2bad2281",file="setting_a_variable.cfm" %}{% endgist %}

``` myVar = "test"; ```

The trailing ";" denoting the end of the statement can be ommitted as long as new statements are on a new line, but convention is to keep the ";"

Lucee script supports all Tags in script by simply wrapping the code block in brackets

{% gist id="roryl/5817942eccef2bad2281",file="script_tags.cfm" %}{% endgist %}

``` savecontent variable="myContent { echo("Output some test"); } ```

View the script reference for all language constructs

Tags

The tag based language loosely resembles HTML.

{% gist id="roryl/5817942eccef2bad2281",file="setting_a_variable_tag.cfm" %}{% endgist %}

``` ```

Tags can have bodies or not. Tags without bodies do not need a closing bracket, but some people prefer them stylistically

{% gist id="roryl/5817942eccef2bad2281",file="optional_closing.cfm" %}{% endgist %}

``` ```

Tags with bodies always need a closing tag

{% gist id="roryl/5817942eccef2bad2281",file="closing_tag_bodies.cfm" %}{% endgist %}

``` Output some text ```