Railo Tip: Trimming with cfsavecontent

August 19, 2010 · By webrat · 3 Comments

Random tip of the week with <cfsavecontent>:

<cfsavecontent variable="tag" trim="true">
This
is
some
content
</cfsavecontent>
<!--- Straight CFML Scripting version: --->
<cfscript>
savecontent variable="script" trim="true" {
writeOutput( '
This
is
some
content
' );
}
</cfscript>
<cfoutput>|#tag#|#script#|</cfoutput>

I had some sample tabs in the above, but the blog destroys the tabs -- feel free to manually add them back. This feature has been around for some time now, so it should be safe to use in any version of Railo 3.1 -- Be safe and test it out anyway.

Tags: Tips

3 responses so far ↓

Leave a Comment

Leave this field empty: