On Monday, September 23, 2002, at 12:57 , Brian Thornton wrote:
> Question 1. How do I invoke a subcomponent within a component?

<cfinvoke component="sub.component" method="foo" returnvariable="res"/>

Or you could create an instance (via cfobject or createObject()) and then 
call the method on that:

<cfset sub = createObject("component","sub.component")/>
<cfset res = sub.foo()/>

> Question 2: Would that subcomponent be classified as remote or private?

If it is in the same directory as the calling component, it could be 
"package" (or at least the *method* you call could be access="package"). 
Otherwise it would need to be access="public".

> Question 3: How do I pass non-required request variables to that 
> receiving subcomponent?

You need to be a little bit more specific about what you're trying to do. 
It is not a good idea to have components be 'environment aware', i.e., 
have them directly manipulate scopes such as "request". That limits the 
component's usefulness.

How are you invoking the main component? How are you passing variables 
into it?

I guess you could say (I haven't tried this):

        <cfinvoke component="main.component" method="bar"
                argumentCollection="#request#" returnvariable="res"/>

This makes every item in the "request" scope available in the "arguments" 
scope inside "main.component". Then when you invoke the sub-component, 
pass argumentCollection="#arguments#" to ensure all those items get passed 
to the sub-component. Ugly.

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to