Matt Gifford aka coldfumonkeh | Consultant Developer
View Github Profile


Lucee 5 - Breaking out of script into tags and back again

Oct 17, 2019

There’s a SECRET bit of functionality in Lucee 5.3.4.* that you may not know about yet, and this is the ability to write tag-based CFML within the context of cfscript code.

Imagine the following example. I have a table into which I want to output the rows of data from a collection. It could be an array, query, nested structures or any other format of data. In this case, I have an array of structural (dummy) data to display:

An array of structs

In my simple example, I want to call a function named getSalesDataRows() to build these iterative table rows and populated cells as a string.

You can do this in script in a number of ways, one of which is to writeOutput() or echo() the rows and table cells.

Whilst this works, for me it’s not easy to read.

In Lucee 5.3, you can actually break out of the cfscript context to write tag-based code using triple backticks. These will be familiar to anyone who’s ever written a block of code in Markdown, but in this instance they switch contexts within Lucee and allow you to write your tag code before closing the backticks and continuing with your cfscript.

That’s it. Nice and easy.

An additional example from the Lucee keynote at CFCamp this morning:


Latest Blog Posts

Jul 16, 2020
Github Actions with CommandBox and TestBox
Read More
Jul 9, 2020
Azure pipelines with CommandBox and TestBox
Read More
Dec 23, 2019
CFML content moderation detection component library
Read More