House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

CFINVOKE - Component Location

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Jenny Gavin-Wear
05/03/2012 11:44 AM

Hi all, I'm trying to work out how to point to the file location of a component using cfinvoke. I am storing all of the component files for my application in one directory which is one step off the web root. Many thanks in advance, Jenny -- I am using the free version of SPAMfighter. We are a community of 7 million users fighting spam. SPAMfighter has removed 29195 of my spam emails to date. Get the free SPAMfighter here: http://www.spamfighter.com/len The Professional version does not have this message

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Raymond Camden
05/03/2012 11:51 AM

Can you use a cfmapping? On Thu, May 3, 2012 at 10:43 AM, Jenny Gavin-Wear <jennygw@fasttrackonline.co.uk> wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Jenny Gavin-Wear
05/03/2012 12:29 PM

Hi Ray, Thanks for your reply. Yes I could use a cfmapping, however .... I'm a bit confused as I thought the cfmappings were for accessing files outside the web root or its sub-directories. I read "By default, ColdFusion MX defines a mapping for the web root (/). You can define additional mappings to allow access to pages outside of the web root."  So I don't understand why I can't use this default mapping- I realise I can't bit I also realise I need to understand why. I created a cfmapping pointing to a directory inside the webroot of the application called /gallerycomponents. Then I tried running the cfinvoke as follows, but it appears I have some syntax wrong. <cfinvoke component="/gallerycomponents/functions.cfc" method="getTags"> I read up in your book, CF 7 Construction Kit, that a mapping can be used when invoking the component, but there wasn't a syntax example using a mapping. Thanks, Jenny ----- Excess quoted text cut - see Original Post for more ----- -- I am using the free version of SPAMfighter. We are a community of 7 million users fighting spam. SPAMfighter has removed 29195 of my spam emails to date. Get the free SPAMfighter here: http://www.spamfighter.com/len The Professional version does not have this message

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Matt Quackenbush
05/03/2012 12:36 PM

You'll want to use dot notation. So, using your example of /gallerycomponents/functions.cfc, you'd do the following: <cfinvoke component="gallerycomponents.functions" method="foo" /> HTH On Thu, May 3, 2012 at 11:29 AM, Jenny Gavin-Wear < jennygw@fasttrackonline.co.uk> wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Jenny Gavin-Wear
05/03/2012 12:47 PM

Thanks Matt. ----- Excess quoted text cut - see Original Post for more ----- (/). ----- Excess quoted text cut - see Original Post for more ----- -- I am using the free version of SPAMfighter. We are a community of 7 million users fighting spam. SPAMfighter has removed 29200 of my spam emails to date. Get the free SPAMfighter here: http://www.spamfighter.com/len The Professional version does not have this message

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bobby
05/03/2012 12:41 PM

Try component="gallerycomponents.functions"

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Jenny Gavin-Wear
05/03/2012 12:47 PM

Thanks Bobby, sorted. ----- Excess quoted text cut - see Original Post for more ----- -- I am using the free version of SPAMfighter. We are a community of 7 million users fighting spam. SPAMfighter has removed 29200 of my spam emails to date. Get the free SPAMfighter here: http://www.spamfighter.com/len The Professional version does not have this message

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Raymond Camden
05/03/2012 01:01 PM

On Thu, May 3, 2012 at 11:29 AM, Jenny Gavin-Wear <jennygw@fasttrackonline.co.uk> wrote: > > Then I tried running the cfinvoke as follows, but it appears I have some > syntax wrong. > > <cfinvoke component="/gallerycomponents/functions.cfc" method="getTags"> No, you use "dot" notation for CFCs. Try <cfinvoke component="gallerycomponents.functions" method="getTags"> -ray

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Rick Faircloth
05/03/2012 01:38 PM

Just for clarification... Why would CF begin to use dot notation for cfc's instead of sticking with the familiar "../", etc, syntax? The dot notation has been a pain in my rear on more than one occasion. Rick On Thu, May 3, 2012 at 11:29 AM, Jenny Gavin-Wear <jennygw@fasttrackonline.co.uk> wrote: > > Then I tried running the cfinvoke as follows, but it appears I have some > syntax wrong. > > <cfinvoke component="/gallerycomponents/functions.cfc" method="getTags"> No, you use "dot" notation for CFCs. Try <cfinvoke component="gallerycomponents.functions" method="getTags"> -ray

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Matt Quackenbush
05/03/2012 01:52 PM

CFCs have used dot notation since Day 1 of their existence. The reason is because CFCs (loosely) represent classes, which are grouped in packages. In other languages, like Java - which CF runs on top of, those packages are always denoted in dot notation. For example: java.util.List java.net.InetAddress java.io.File HTH On Thu, May 3, 2012 at 12:38 PM, Rick Faircloth <Rick@whitestonemedia.com>wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Matt Quackenbush
05/03/2012 01:55 PM

Continuing on that thought (hit [send] too soon)... On the other hand, *.cfm "templates" match up with a standard file, and therefore use the traditional web separator, the slash (/). On Thu, May 3, 2012 at 12:52 PM, Matt Quackenbush <quackfuzed@gmail.com>wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Christopher Watson
05/03/2012 01:56 PM

In all my work with CF, I have always housed my CFCs in a dedicated root directory (typically named CFC), and I just set up the path alias in CF Admin, so that all I ever have to use in the component attribute of the <cfinvoke> tag is the actual name of the component: <cfinvoke component="BusCalcs" method="CalcMonthlyStats" returnvariable="StatsQuery"/> CF knows where to find them. I only use dot notation when I have developed a full-on component "package" (which I have done a lot of). For example, we have a package here called RevCore, which is a component tree contained within a mapped directory (as above), where the leaf nodes are up to 5 levels deep, and everything extends a parent component, all the way up to the root RevCore component. The individual components are then addressed as such: <cfinvoke component="RevCore.Trip.Travel.Cruise.CruiseShipRoom" method="CruiseShipRoomCreate" returnvariable="NewCruiseShipRoomID"> -Christopher >Why would CF begin to use dot notation for cfc's instead of sticking >with the familiar "../", etc, syntax? > >The dot notation has been a pain in my rear on more than one occasion.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Jochem van Dieten
05/03/2012 02:08 PM

On Thu, May 3, 2012 at 7:38 PM, Rick Faircloth wrote: > Why would CF begin to use dot notation for cfc's instead of sticking > with the familiar "../", etc, syntax? Because it represents the package and the component instead of the directory and the file, i.e. it represents a logical hierarchy instead of a physical one. One might even say that you are not supposed to know something as mundane as a filesystem location (an implementation, let CF figure out where it is), and should just work with the exposed functionality (the interface). Jochem -- Jochem van Dieten http://jochem.vandieten.net/


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 22, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference