On Nov 17, 2007 6:14 AM, Dominic Watson <[EMAIL PROTECTED]>
wrote:
>
>
> Perhaps I was not clear in the initial post, but here is an example of how
> this works to solve the problem of not being able to use relative paths
> for
> components. Let us say you have the following folder struct:
>
> wwwroot\
> wwwroot\application.cfm
> wwwroot\components\
> wwwroot\components\subFolder\
> wwwroot\components\subFolder\myCFC.cfc
> wwwroot\templates\
> wwwroot\templates\myCallingTemplate.cfm
>
> If you want to invoke myCFC.cfc from myCallingTemplate.cfm you might do so
> with a mapping called 'myMapping' which maps to wwwroot\components\ and in
> myCallingTemplate.cfm you could do:
>
> <cfinvoke component="myMapping.subFolder.myCFC" method="init"
> returnvariable="myObj">
OK, but in this case why even use a mapping? You don't need to. You can just
invoke "components.subFolder.myCFC" and be done with it.
>
> Placing the GetCFC UDF in the wwwroot\components\ folder has the same
> effect
> as this mapping in that it gives you a reference point from that location.
> So, in application.cfm/cfc:
>
> <cfinclude template="components\getCFC.cfm">
> <cfset application.getCFC = getCFC>
>
> Then in myCallingTemplate.cfm:
>
> <cfset myObj = application.getCFC("subFolder.myCFC")>
>
Again, I don't see what this saves you, since you first have to know the
path to the components folder (in this case, "components"), you stilll have
to know the path from that component folder to the target CFC ("
subFolder.myCFC"), and you have to manually copy the getCFC.cfm file into
the correct folder. In other words, you have to know the same information to
do this that you would just to call the component directly ("
component.subFolder.myCFC"). I think I might still be missing something in
what you're describing, because so far this approach doesn't seem to be
doing much.
> It is a very simple 'factory' yes, but if simple is what you need then it
> is
> a useable alternative to a mapping. Also, in the above example, I think
> that
> you WOULD be 'forced' into using a mapping should you want to do this and
> not use such a factory or ColdSpring, etc. Or is there another way that I
> am
> missing?
>
Maybe this is what you're missing, because you don't need to have a mapping
in this example to use ColdSpring or just to call the components yourself.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get involved in the latest ColdFusion discussions, product
development sharing, and articles on the Adobe Labs wiki.
http://labs/adobe.com/wiki/index.php/ColdFusion_8
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293542
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4