Solved

Coldfusion cfinvoke with relative path

Posted on 2010-11-15
3
1,248 Views
Last Modified: 2012-05-10
Hello,

I am using coldfusion to invoke components and I have this question:

Is there a way to invoke a component using a relative path?

My problem is this:

In my development environment, I am using one CF install to work on multiple sites, meaning that my site root folders look like this :  http://localhost:8500/site1, http://localhost:8500/site2, etc...

On my remote host, however, I do not use this "/site1 or /site2" directory structure, but rather just the site root.  So instead of 'www.mysite.com/site1', my URL is 'www.mysite.com'  

This poses a problem when my component calls during development HAVE to go through the 'site1' directory (ex. <cfinvoke component="site1.main.components.myComponent"), and my component calls during deployment do NOT (ex. <cfinvoke component="main.components.myComponent").

I do not want to have to change ALL my <cfinvoke> tags EVERY time I put files, then change them back EVERY time I test them locally.

Does anyone have a solution to this problem?
0
Comment
Question by:chaseivey
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 250 total points
ID: 34137105
Store your cfc root in an application variable on start up.
       <cfset application.cfcroot = "site1.main.components">

Then use it when invoking components
       <cfinvoke component="#application.cfcroot#.myComponent" ...>

Then you only have to change one variable when switching to the remote site.  There are better options for Apache, IIS, etc... but those won't work with the builtin web server.
0
 

Author Closing Comment

by:chaseivey
ID: 34167229
I apologize for the delayed answer. For some reason, I thought I already answered.  :(. Thank you for the help
0
 
LVL 52

Expert Comment

by:_agx_
ID: 34167279
You're welcome (Btw: I've seen questions open for 10 months or more. So a couple days is pretty good ;-)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now