Solved

Coldfusion cfinvoke with relative path

Posted on 2010-11-15
3
1,274 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

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…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

738 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