Back to the notebook

UDF file in Model Glue

This has just came up on the MG Lists and I thought i should post my solution on how I implement a UDF file in MG1)My UDF file is a component (cfc) on the root of the site. Example UDF:
<cffunction name="getDateTime"> <cfreturn now() /></cffunction>
2)Then in my controller (in the onRequestStart):
<cfset variables.udf = createObject("component","pathTo.udf").init()><cfset arguments.event.setValue("udf", variables.udf)>
3)On my view page I have<cfset udf = viewState.getValue('udf') />
Then to call a function<cfoutput>#udf.getDateTime()#</cfoutput>

Leave a note.