Why don't you just but your UDF's in your Application.cfc directly? Then those functions are automatically available from anywhere within your Application.cfc. Otherwise, I would put those functions within a utility cfc, which you could place in an APPLICATION scoped variable inside your onApplicationStart() method, which you could then access from anywhere within your application. Either method should force you to re-evaluate how you set and reset your scope variables, and you will probably find better ways of doing these things than you may have used in the past.
Steve "Cutter" Blades Adobe Certified Professional Advanced Macromedia ColdFusion MX 7 Developer Co-Author of "Learning Ext JS" http://www.packtpub.com/learning-ext-js/book _____________________________ http://blog.cutterscrossing.com On 9/23/2009 6:36 AM, SANJEEV SINGLA wrote: > I need help in converting application.cfm to application.cfc. I have > few functions defined in my current application.cfm, out of which few > are called within application.cfm only. > > One of the function I have in my application.cfm is like as below: > > <cffunction name="loadAppCFC" access="public" displayname="Load CFC > module" hint="Load CFCs into the application scope"> > <cfargument name="ObjectName" REQUIRED="Yes" > TYPE="variableName"> > <cfargument name="LocalName" type="variableName" > default="#Arguments.ObjectName#"> > <cfargument name="Reload" type="string" default="n"> > > <cfif Arguments.Reload eq "y" OR NOT IsDefined > ("Application.Obj.#Arguments.ObjectName#") OR ISDefined > ("Application.CFCReload.#Arguments.ObjectName#")> > <CFTRACE text="Reloading cfc object #Arguments.ObjectName# > - #ISDefined('Application.CFCReload.#Arguments.ObjectName#')#"> > <cflock timeout="5" throwontimeout="Yes" > name="#Arguments.ObjectName#" type="EXCLUSIVE"> > <cfobject name="Application.Obj.#Arguments.LocalName#" > component="\CMP\#Arguments.ObjectName#"> > <CFIF IsDefined("Application.CFCReload")> > <cfset StructDelete(Application.CFCReload, > Arguments.ObjectName, "True")> > </CFIF> > </cflock> > </cfif> > <cfset Variables[Arguments.LocalName] = evaluate > ("Application.Obj.#Arguments.LocalName#")> > </cffunction> > > In my Application.cfm loadAppCFC is used as below: > > <CFSET loadAppCFC("comUDF", "comUDF", > Application.ini.debug.ReloadObjects)> > > **** comUDF is again a CFC file containg UDF's. > > Now when I am converting the code to application.cfc I inlcuded > onApplicationStart, OnSessionStart and OnRequest events. I separated > all the udf's into one file (all_udf.cfm) and I am including them as > below: > > <cffunction name="onRequest"> > <cfargument name="targetPage" type="string" required="yes"> > <cfinclude template="all_udf.cfm"> > <cfinclude template="#targetPage#"> > </cffunction> > > I also included that file under onApplicationStart as below: > <cffunction name="onApplicationStart" returntype="boolean"> > <cfinclude template="all_udf.cfm"> > > > > But I am still getting the error as "COMUDF is undefined". Please see > if anyone can provide any pointers in this regard.. > > > Thanks! > Sanjeev Singla > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:326535 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

