Return to v2.0 docs

contentFor()


View Helpers Miscellaneous Functions void controller


Used to store a section's output for rendering within a layout. This content store acts as a stack, so you can store multiple pieces of content for a given section.

Name Type Required Default Description
position any No last The position in the section's stack where you want the content placed. Valid values are first, last, or the numeric position.
overwrite any No false Whether or not to overwrite any of the content. Valid values are false, true, or all.
<!--- In your view --->
<cfsavecontent variable="mySidebar">
<h1>My Sidebar Text</h1>
</cfsavecontent>
<cfset contentFor(sidebar=mySidebar)>
<!--- In your layout --->
<html>
<head>
<title>My Site</title>
</head>
<body>
<cfoutput>
#includeContent("sidebar")#
#includeContent()#
</cfoutput>
</body>
</html>

Related Functions

Miscellaneous Functions