Q:

Coldfusion: splitting a tag across onRequestStart() and onRequestEnd() in Application.cfc

I'm trying to see if there is a way to split a CFSAVECONTENT tag across the onRequestStart() and onRequestEnd() functions in Application.cfc to save the generated HTML of any .cfm page in the application to a variable. 
Adding <cfsavecontent variable="html"> to onRequestStart() and adding </cfsavecontent> to onRequestEnd() isn't allowed since the tag must be closed in the function.
Is this even possible to do? I'm trying to avoid hard coding the CFSAVECONTENT this into every .cfm page of the site.
Thanks!

A:

Alex,
You could do something like this in OnRequest (untested, but should work).
<cffunction name="onRequest" returnType="void">
    <cfargument name="thePage" type="string" required="true">
    <cfsavecontent variable="html">
    <cfinclude template="#arguments.thePage#">
    </cfsavecontent>
    <!--- do whatever you want with the html variable here (for example, output it) --->
    <cfoutput>#html#</cfoutput>
</cffunction>

