Skip to main content
September 21, 2008
Question

updating application to use Application.cfc

  • September 21, 2008
  • 1 reply
  • 238 views
I have an application that is using the older style application.cfm for setting up configuration varibles like DSN and what not. Of course this way i can just use the varibles as is like #dsn#.

I am wanting to change my application over to utilize Application.cfc instead now. It seems to set up my DSN efficiently i would set this varible up in the onApplicationStart or onRequestStart. Either way I have to now state my varibles as #application.dsn# to make them work now.

Is there anyway around this so I dont have to change hundreds of varibles names!
    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    September 21, 2008
    Implement
    <cffunction name="onRequest">
    <cfargument name = "targetPage" type="String" required=true/>
    <cfsavecontent variable="content">
    <cfinclude template="#Arguments.targetPage#">
    </cfsavecontent>
    <cfoutput>#content#</cfoutput> <!--- requested page content --->
    </cffunction>

    You can then change gear in onRequestStart with:

    <cfset dsn = application.dsn>

    In fact, you can forget about application.dsn and do the following in onRequestStart:

    <cfset dsn = "myDSN">