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:326530
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4