But (normally), extends should only be used to create a "Is A"
releationship. Settings doesn't match this rule. Just in case it
wasn't too obvious for others, here is a super simple example of what
I'm talking about. Please note I did not include attributes like
output=false, hint, var statements, etc, just to make things tighter:
settings.cfc:
<cfcomponent>
<cffunction name="getSettings" returnType="struct">
<!--- set a bunch of vars, or load them from the db, or an xml
file, or whatever --->
<!--- simple hard coded example here --->
<cfset var settings = structNew()>
<cfset settings.dsn = "moo">
<cfreturn settings>
</cffunction>
</cfcomponent>
foo.cfc:
<cfcomponent>
<cfinvoke component="settings'" method="getSettings"
returnVariable="variables.settings">
<cffunction name="getStuff">
<cfquery name="stuff" datasource="#variables.settings.dsn#">
select whatever
</cfquery>
<cfreturn stuff>
</cffunction>
</cfcomponent>
What's nice then is that your Application.cfm can use the same
cfinvoke statement to get global settings, although it would use
returnVariable="application.settings". So now both your CFCs and your
outside code all use the same method to get their settings.
On Sat, 13 Nov 2004 17:47:57 +0200, Murat Demirci <[EMAIL PROTECTED]> wrote:
> For your specific situation you can use <cfmodule> in your cffunction(s) or
> develop a global component which creates variables.settings internally and
> extend it.
>
> Murat.
>
>
>
> > -----Original Message-----
> > From: Charles Heizer [mailto:[EMAIL PROTECTED]
> > Sent: Saturday, November 13, 2004 2:12 AM
> > To: CF-Talk
> > Subject: cfc - cffunction question
> >
> > Hello,
> > I was wondering if it was possible to do a cfinclude in a cffunction
> > tag?
> >
> > I have a globals.cfm file which has site wide variables set
> > and I want
> > to reference them with out using cfinvokeargument tag.
> >
> > I hope this make sense,
> > Thanks a bunch,
> > - Charles
> >
> >
> >
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:184222
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54