Back
contentFor()
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.
<!--- 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>
Copied!