/wwwroot/yourapp/lib/util.cfc
<cfcomponent name="util">
<cffunction name="FormatMRN" ...>
<cfargument name="inStr" ...>
...code here...
<cfreturn outStr>
</cffunction>
</cfcomponent>Then inside your application.cfm, you could put
<cfif NOT StructKeyExists(application,"util")>
<cfset application.util = createObject("component","lib.util")>
</cfif>then when you need to use it through-out the existance of your application, you simply go:
<cfset sResult = application.util.FormatMRN(myString)>
That way you instantiate once, use many. But all of the below and above work, its just what suites you i guess.
Regards, Scott Barnes CodeMonkey.
Mark Stanton wrote:
Yes thats exactly right.
The function itself can be coded in the format:
<cfscript> function FormatMRN(inStr) { ...code here... return outStr } </cfscript>
OR
<cffunction name="FormatMRN" ...> <cfargument name="inStr" ...> ...code here... <cfreturn outStr> </cffunction>
This code can either be placed in the current file (not very good for reuse) or included from an external file.
Cheers
Mark
--- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
