Skip to content

View Helpers

includeLayout()

includeLayout() — returns string

Available in: controller Category: Miscellaneous Functions

Includes the contents of another layout file. This is usually used to include a parent layout from within a child layout.

NameTypeRequiredDefaultDescription
namestringnolayoutName of the layout file to include.
// 1. Include the default parent layout from within a child layout
// (looks for `app/views/layout.cfm` by default)
#includeLayout()#

// 2. Include a specific parent layout by path
// (looks for `app/views/layouts/application.cfm`)
#includeLayout("/layouts/application.cfm")#

// 3. Pass section content to the parent layout before including it
// Capture sidebar markup to make it available in the parent layout
<cfsavecontent variable="sidebar">
  <nav>
    #includePartial("categories")#
  </nav>
</cfsavecontent>
<cfset contentFor(sidebar=sidebar)>

// Then pull in the parent layout that renders the sidebar via includeContent()
#includeLayout("/layouts/application.cfm")#