<cfsavecontent>
Saves the generated content inside the tag body in a variable.
This tag must have a body.
This tag is also supported within <cfscript>
<cfsavecontent
variable=string
trim=boolean
append=boolean
><!--- body ---></cfsavecontent>
| Attribute | Description |
|---|---|
variable
string, required
|
edit
The name of the variable in which to save the generated content inside the tag. |
trim
boolean, optional
|
edit
trim result |
append
boolean, optional
|
edit
if true, the saved content will be appended to an already existing variable instead of overwriting it. |
Examples
edit<cfoutput>
<cfsavecontent variable="test">
Here you can add any cf, HTML elements etc.,
Where you need it just place the variable of cfsavecontent, automatically shows the content stored here.
</cfsavecontent>
<cfsavecontent variable="example">
<br>
<input type="text" name="textfield">
</cfsavecontent>
#test#
#example#
</cfoutput>
cfsavecontent( variable="test" ){
echo("Here you can add any cf, HTML elements etc.,");
}
echo(test);
Related System Properties / Environment Variables
- LUCEE_SECURITY_LIMITEVALUATION - Disable evaluating expressions when accessing scopes, Lucee 7 defaults to enabling this setting for security reasons. A boolean value. If enabled, limits variable evaluation in functions/tags. If enabled, you cannot use expressions within [ ] like this: susi[getVariableName()]. This affects the following functions: IsDefined, structGet, structSort (when using pathToSubElement), empty and the following tags: savecontent attribute `variable`
Type: boolean, Default: false (Lucee 6), true (Lucee 7)
See also
- Core CFML Language
- Render()
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)