CFLib.org – Common Function Library Project

savecontent(content)

Last updated March 30, 2014

author

Adam Cameron

Version: 1 | Requires: CF10 | Library: CFMLLib

Description:
Best to just read this: http://cfmlblog.adamcameron.me/2014/03/how-about-this-for-savecontent.html

Return Values:
A string containing the captured content

Example:

days = ["R?hina","R?t?","R?apa","R?pare","R?mere","R?horoi","R?tapu"];
contentViaFunction = savecontent(function(){
    var decoratedDays = days.map(function(v){
        return "<li>#v#</li>";
    });
    writeOutput("<ul>#decoratedDays.toList('')#</ul>");
});
writeOutput(contentViaFunction);

Parameters:

Name Description Required
content A function containing the processing to capture the content of Yes

Full UDF Source:

/**
 * Implements CFSAVECONTENT as a function
 * v1.0 by Adam Cameron
 * 
 * @param content 	 A function containing the processing to capture the content of (Required)
 * @return A string containing the captured content 
 * @author Adam Cameron (dac.cfml@gmail.com) 
 * @version 1.0, March 30, 2014 
 */
string function saveContent(required function content){
	savecontent variable="local.saved" {
		content();
	}
	return local.saved;
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson