I'd say this was absolutley fine. I'd put the includes in
OnApplicationStart and then put each udf into the application scope to
avoid including the files on each request (well I'd actually use
Model-Glue 3 but this is what I'd do if I was doing what you're
doing); something like:
<cffunction name="onApplicationStart">
...
<cfinclude template="theUdfs.cfm">
<cfinclude template="theUdfs2.cfm">
...
<cfset application.udfs = StructNew()>
<cfset application.udfs.MyFunction1 = MyFunction1>
<cfset application.udfs.MyFunction2 = MyFunction2>
<cfset application.udfs.MyFunction3 = MyFunction3>
...
</cffunction>
Then, to avoid verbosity when calling a udf, I'd add this line in
OnRequestStart()
<cffunction name="onRequestStart">
...
<cfset variables.udfs = application.udfs>
...
</cffunction>
This has created a custom 'scope', if you will (its not but hey),
called 'udfs' - Model-Glue 3 creates one called 'helpers' which might
be another name you'd like. So now, when you need MyFunction1, you can
call it cleanly as:
<cfset foo = udfs.MyFunction1(bar)>
That idea is off the top of my head and probably bonkers but it works
for me ;) Nothing wrong with what you are doing.
Dominic
2008/5/19 Richard White <[EMAIL PROTECTED]>:
>
> hi,
>
> just wondering how you guys deal with you reusable functions
>
> we were thinking that instead if having to look into what reusable functions
> we have, then decide which functions we need in a page and then including
> them within a page, that we just build our library and include everything in
> the application.cfc page
>
> then we will just need to look at what function we want and then use it. is
> this the right way to do it?
>
> thanks
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:305612
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4