Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

updating application to use Application.cfc

Guest
Sep 20, 2008 Sep 20, 2008
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!
240
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 20, 2008 Sep 20, 2008
LATEST
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">


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources