A quick and clean way is to create a cfc named 'utils', 'udfs' or 'helpers'
or somesuch. In that, place your MyDecimalFormat function, along with any
other udfs you may have. Then, in application.cfc:

<cffunction name="onApplicationStart">
 <cfset application.udfs = CreateObject('component', 'path.to.my.udfs');
</cffunction>

Then, when you need it:

#application.udfs.MyDecimalFormat(myNum)#

You could also do something like 'variables.udfs = application.udfs;' in
OnRequestStart() to make things less verbose when using your udfs, i.e. you
could then do:

#udfs.MyDecimalFormat(myNum)#

HTH

Dominic



2009/11/23 Chad Gray <cg...@careyweb.com>

>
> Is there any good way to have a function like this included in all pages?
>  I can't put it in application.cfc.
>
> <cfscript>
> function MyDecimalFormat(some_value) {
>        // call DecimalFormat to handle rounding, then strip out commas
>        return Replace(DecimalFormat(some_value),",","","ALL");
> }
> </cfscript>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328631
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to