Solved

Coldfusion cfinvoke with relative path

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

Command Line Tips and Tricks

The command line is a powerful tool at the disposal of every Linux user. Although Linux distros come with beautiful user interfaces, it's worthwhile to learn the command line because it allows you to do a number of things that you otherwise cannot do from the GUI.  

Question has a verified solution.

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

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…
Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

623 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