cfsavecontent

Description

Saves the generated content of the cfsavecontent tag, including the results of evaluating expressions and executing custom tags, in the specified variable.

Syntax

<cfsavecontent  
    variable = "variable name"> 
    the content 
</cfsavecontent>
Note: You can specify this tag's attributes in an attributeCollection attribute whose value is a structure. Specify the structure name in the attributeCollection attribute and use the tag’s attribute names as structure keys.

See also

Caching parts of ColdFusion pages in the Developing ColdFusion Applications

Attributes

Attribute

Req/Opt

Default

Description

variable

Required

 

Name of the variable in which to save the generated content of the tag.

Usage

This tag requires an end tag.

You cannot use this tag to suppress output from a tag library.

Example

The following example uses a custom tag to generate a report and saves the report in the variable CONTENT. It replaces all instances of the word "report" with the phrase "MyCompany Quarterly Report" and outputs the result.

<cfsavecontent variable="content"> 
    <CF_OutputBigReport> 
</cfsavecontent> 
<cfoutput> 
    #replace(content, "report", "MyCompany Quarterly Report", "all")# 
</cfoutput>