Utility Function: RenderTemplate()
- October 30, 2008 5:30 AM
- ColdFusion, Utility Function
- Comments (0)
This function is half-way to being a really nice function. I just wish that I could pass in arguments, or a structure to use as the variables available in the rendered template. I'd love to have that isolation...
<cffunction name="RenderTemplate" access="public" output="false" returnType="string">
<cfargument name="path" type="string" required="false" />
<cfset var local = StructNew() />
<cfsavecontent variable="local.returnValue">
<cfinclude template="#arguments.path#" />
</cfsavecontent>
<cfreturn local.returnValue />
</cffunction>