Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

cfc / ajax / must be in root directory

Guest
May 16, 2008 May 16, 2008
I am just starting to work with the CF 8 ajax. I am finding many in posts/examples that to get the cfc to work, it must be in the root directory. I am not finding specific information on what is causing this other than a conflict with the application.cfm / application.cfc file.
What is allowed and what is not allowed to go into an application file to allow .cfc to work in the same directory as the file calling it?

It is very inconvenient to have to place all the cfc files at the root and not in the same directory as the file calling it.

the last example i was working with comes from:
http://www.brucephillips.name/blog/index.cfm/2007/8/8/Updating-and-Adding-Records-Being-Displayed-In...

which describes the .cfm and .cfc file to be in the same directory. (which doesnt work) -- but in the comments - there is the example of locating the .cfc file in the root directory and adding a slash (/) in front of the path. and this works for me.
I had the same problem yesterday trying to get the Ben Forta art.cfc autosuggest example working.
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 16, 2008 May 16, 2008
iirc, the main requirement for using cfc's and cf ajax features is that
cfc's muct be under web root, i.e. web-accessible. you can't use cfc's
in a mapped location. but they do not have to be IN the web root - they
can just as well be in [webroot]/folder/folder/folder/.../folder/cfc

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 19, 2008 May 19, 2008
i guess that is the question i am trying to ask. that the cfc doesnt work UNLESS it is at the exact webroot.

if i place the cfc in the same directory as the .cfm page -- the cfc does not work.
if i take the cfc and drop it to the root of the webroot - it does work.
i am on IIS.

i am copying and pasting examples exactly as people are using them and none work.
if i move the cfc and adjust the pathname -- it works all the time.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 19, 2008 May 19, 2008
what si your folder structure? how are you calling your cfc? what is the
eror you get? did you use cf's ajax debugger to debug the error? do you
have any special mappings set up in cf admin? any virtual directories in
IIS related to your app or cfcs?

here's verbatim from cf dev guide:
"
If you use a cfinvoke or cfobject tag, or the CreateObject function, to
access the CFC from a CFML page, ColdFusion searches directories in the
following order:
a) Local directory of the calling CFML page
b) Web root
c) Directories specified on the Custom Tag Paths page of ColdFusion
Administrator
- If you specify only a component name, ColdFusion searches each of
these directories, in turn, for the component.
- If you specify a qualified path, such as myApp.cfcs.myComponent,
ColdFusion looks for a directory matching the first element of the path
in each of these directories (in this example, myApp). If ColdFusion
finds a matching directory, it looks for a file in the specified path
beneath that directory, such as myApp\cfcs\myComponent.cfc, relative to
each of these directories.
Note: If ColdFusion finds a directory that matches the first path
element, but does not find a CFC under that directory, ColdFusion
returns a not found error and does not search for another directory.
- If you invoke a CFC method remotely, using a specific URL, a form
field, Flash Remoting, or a web service invocation, ColdFusion looks in
the specified path relative to the web root. For form fields and URLs
that are specified directly on local web pages, ColdFusion also searches
relative to the page directory.
"

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 19, 2008 May 19, 2008
i have narrowed down the problem to any directory that was below a blank application.cfm file - why would that cause an issue?
wwwroot = worked fine
wwwroot/testcfc = worked fine
wwwroot/myapp = did not work - but this had a blank application.cfm file in it - containing ONLY a small amount of commented out code.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 19, 2008 May 19, 2008
the code in application.cfm gets processed before each and every
request, and any output of application.cfm gets attached to each and
every request. does not matted if a request is for a .cfm or a .cfc
page. and since cf functions using ajax calls usually expect properly
formed json data in return, any output added by application.cfm file
will break the data format.

are the coments in your application.cfm file proper cf comments or html
comments? any blank lines in it?

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 19, 2008 May 19, 2008
they are cf comments...
but there are several blank lines between commented sections.
i appreciate all the information with this, it explains the behavior that i was getting.
want to take a shot at why my debugging will not work? ;-)
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=3&threadid=1315339
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 19, 2008 May 19, 2008
LATEST
sorry, i do not use eclipse enough for cf development to help you with
that... :)

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources