Sam,

I do the same exact thing in my applications. I do it so that I do not need
mappings for any of these calls. Works like a charm and I have never had a
problem with it. 

In addition to this, I also have an InitSession and InitApplication helper
functions. Other than that, most things go in separate CFCs. 

Not really advice here, just saying that I do what you do - safety in
numbers ;)

.......................
Ben Nadel 
Web Developer
Nylon Technology
6 West 14th Street
New York, NY 10011
212.691.1134
212.691.3477 fax
www.nylontechnology.com

"Vote for Pedro"

-----Original Message-----
From: Sam Farmer [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 09, 2005 3:32 PM
To: CF-Talk
Subject: Best Practice: Additional Functions in Application.cfc

Working on a website where cfc's will go in a cfc folder.  In an
effort to not cause additional mappings I created a function called
newObj that I want to put in the application scope.

The easiest way to do this is to put the function in the
Application.cfc.  What are peoples thoughts on a best practice for
this?

Should additional functions go in the Application.cfc or should be it
exclusive of the various onStart and onEnd functions
(onApplicationEnd, onApplicationStart, onError, onRequest,
onRequestEnd, onRequestStart, onSessionEnd, onSessionStart)?


<cffunction name="onApplicationStart" returnType="boolean" output="false">

                <cfset application.newObj = newObj>
                <cfreturn true>
        </cffunction>
        
        <cffunction name="newObj" access="public"
returntype="WEB-INF.cftags.component">
                <cfargument name="cfc" type="string" required="true">
                <cfset obj =
createObject("component","cfc.#arguments.cfc#")>
                <cfreturn obj>
        </cffunction>

Cheers,

Sam F



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226697
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to