Solved

Coldfusion cfinvoke with relative path

Posted on 2010-11-15
3
1,260 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 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