|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
CFINVOKE - Component Location
Hi all,Jenny Gavin-Wear 05/03/12 11:44 A Can you use a cfmapping?Raymond Camden 05/03/12 11:51 A Hi Ray,Jenny Gavin-Wear 05/03/12 12:29 P You'll want to use dot notation. So, using your example ofMatt Quackenbush 05/03/12 12:36 P Thanks Matt.Jenny Gavin-Wear 05/03/12 12:47 P Try component="gallerycomponents.functions"Bobby 05/03/12 12:41 P Thanks Bobby, sorted.Jenny Gavin-Wear 05/03/12 12:47 P On Thu, May 3, 2012 at 11:29 AM, Jenny Gavin-WearRaymond Camden 05/03/12 01:01 P Just for clarification...Rick Faircloth 05/03/12 01:38 P CFCs have used dot notation since Day 1 of their existence. The reason isMatt Quackenbush 05/03/12 01:52 P Continuing on that thought (hit [send] too soon)...Matt Quackenbush 05/03/12 01:55 P 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:Christopher Watson 05/03/12 01:56 P On Thu, May 3, 2012 at 7:38 PM, Rick Faircloth wrote:Jochem van Dieten 05/03/12 02:08 P 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 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 ----- 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 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 ----- 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 Try component="gallerycomponents.functions" 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 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 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 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 ----- 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 ----- 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. 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/
|
May 22, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||