|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
CFINVOKE - Component Location
Author: Jenny Gavin-Wear
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63893#350972
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
Author: Raymond Camden
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63893#350974
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 -----
Author: Jenny Gavin-Wear
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63893#350976
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
Author: Matt Quackenbush
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63893#350977
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 -----
Author: Bobby
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63893#350979
Try component="gallerycomponents.functions"
Author: Jenny Gavin-Wear
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63893#350980
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
Author: Jenny Gavin-Wear
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63893#350981
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
Author: Raymond Camden
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63893#350982
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
Author: Rick Faircloth
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63893#350984
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
Author: Matt Quackenbush
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63893#350985
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 -----
Author: Matt Quackenbush
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63893#350986
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 -----
Author: Christopher Watson
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63893#350987
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.
Author: Jochem van Dieten
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63893#350988
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 20, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||