Includes the content from the referenced file (template). The content may be executed as CFML, see compatibility info below. You can embed cfinclude tags recursively. For another way to encapsulate CFML, see cfmodule. (A CFML page was formerly sometimes called a CFML template or a template.)

 <cfinclude template="" runonce="true|false">

 include "template.cfm" runonce=true;

cfinclude Attribute Reference


A logical path to a CFML page.

Default: false

If set to true, the given template (if already processed) is not processed again for a given request. CF 10+



CF9: Added the script syntax: include.
CF10: Added runonce attribute.
CF11: Changed behaviour such that only files with the extension cfm or cfml are compiled and executed by cfinclude (configurable in Application.cfc via this.compileextforinclude), all other files will be statically included.

Examples sample code using the cfinclude tag

Script Syntax

include "mypage.cfm";

Tag Syntax

<cfinclude template="mypage.cfm">

Fork me on GitHub