In Coldfusion, how do I init a component that is located above the current path folder?

Posted by Dan Sorensen on Stack Overflow See other posts from Stack Overflow or by Dan Sorensen
Published on 2010-03-26T18:35:17Z Indexed on 2010/03/26 20:03 UTC
Read the original article Hit count: 344

Filed under:
|

If I have a folder structure that looks like this:

/
/bin/myComponent.cfc
/reports/index.cfm

How do I initiate myComponent.cfc from index.cfm?

myService = createObject("component", "bin.myComponent");

Using the dot syntax, I know how to go to deeper folders, but how to do I go up a folder, and down into the other folder? Using slash syntax it would be something like this:

../bin/myComponent.cfc

But createObject() doesn't work that way. I'd like to keep a relative path so that I can move this folder to another server without breaking the paths.

Ideas? Thanks!

© Stack Overflow or respective owner

Related posts about coldfusion

Related posts about cfc