Title: Message

You can always set a cfc property to be the dsn and give it a default.

 

<cfcomponent>

            <cfset variables.dsn = “” />

           

            <cffunction name=”init”>

                        <cfargument name=”dsn” type=”string” required=”no” default=”myDefaultDSN” />

            </cffunction>

 

</cfcomponent>

 

That way you can either specify it when invoking your object or let it use a default value.

 

Sean

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tony Weeg
Sent:
Tuesday, September 16, 2003 11:34 AM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] application.cfm and cfc's

 

all makes sense, and it doesnt matter on a windows box :) (the capital A, that is), but

i can verify that the cfc isnt picking up variables that i have declared in my application.cfm file

is this expected behaviour?

 

 

tony weeg
sr. web applications architect
navtrak, inc.
[EMAIL PROTECTED]
www.navtrak.net
office 410.548.2337
fax 410.860.2337

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Farrar
Sent: Tuesday, September 16, 2003 11:26 AM
To: [EMAIL PROTECTED]
Subject: Re: [CFCDev] application.cfm and cfc's

You can try using an "application" scoped variable... but community opinion (which is always right ... correct, so we jump to another community if to become right... anyway) community opinion is that encasulation would keep a CFC ignorant about it's environment. It only knows what you tell it. So, you should pass the information into the cfc... or tell the cfc where to look the information up at least. (like in an include file.)

 

The only time this becomes an issue is with Web Services or Flash Remoting. Then you are calling the CFCs externally, and then you may want to use the Application.cfm file for declaration, but the include file leans more towards the concept of encapsulation. (Also, if you are on linux... don't know if this is still an issue, but the Application.cfm required a capital 'A' according to older docs. Don't have a linux server running CF... can't tell you. That could cause someone to not get the Application.cfm file to be called though, if it wasn't case correct.)

 

John Farrar

----- Original Message -----

From: Tony Weeg

Sent: Tuesday, September 16, 2003 11:12 AM

Subject: [CFCDev] application.cfm and cfc's

 

yah!

i understand.

 

now, does the Application.cfm file get processed before cfc's get processed.

 

i have application.cfm with my site wide dsn's established in there.

i reference said dsn variable, and its spitting up, saying its not defined?

 

weird.

tony weeg
sr. web applications architect
navtrak, inc.
[EMAIL PROTECTED]
www.navtrak.net
office 410.548.2337
fax 410.860.2337

Reply via email to