Thanks, Andrew... I'll have a go at some of that!
Rick -----Original Message----- From: Andrew Clarke [mailto:s...@clarke.ca] Sent: Tuesday, June 08, 2010 4:16 PM To: cf-talk Subject: Re: How do I solve this path issue for components? There are a lot of different ways to solve this problem, but here are a couple. 1. Use a variable to denote your CFC root. For instance, you could set request.pathRoot or something. So in development you'd have request.pathRoot = "mySite-dev"; and in production it would be request.pathRoot = "mySite". Then when you create an object, do something like myComponent = createObject("component", "#request.pathRoot#.myComponent"); 2. Use a factory object, or a façade, or whatever you want to call it, to create your other objects. You still have to create your façade object, but for example, you could have request.facade with a function like returnObject() or something like that. Then in your code you'd do myComponent = request.facade.returnObject("myComponent"); There are lots of frameworks that essentially do this in more complicated fashions, but by doing something like this you aren't leaving all the code across your site reliant on the existence of request.pathRoot. You can keep the logic for where your components are located in just Application.cfc and Facade.cfc (or wherever). This isn't really a factory or a façade, per se, but I'm not really sure what the best term would be. You can learn as much about Inversion of Control (I'm explaining a simplified version of it in #2) by checking out the ColdBox or ColdSpring frameworks. - Andrew. On 2010-06-08, at 16:03, Rick Faircloth wrote: > > Hi, all. > > > > I've started using two different folders on my servers for each site. > > The first is for viewing a site online during development and the second > > folder is for production. > > > > That is creating path issues with my component path notation. > > > > If a path is on the index.cfm in the root of a site, I can use: > > > > components.myComponent > > > > The path above works for both development and production sites > > since the "component" directory is always directly under the root. > > > > However, on all other pages, such as .cfm pages within a cfm directory, > > I have been just specifying my webroot in the path to make it work: > > > > mySite.components.myComponent > > > > But with different root directories for development and production, > > that won't work. > > > > Locally, I have this directory structure: (Typically, I just mirror this > structure > > on my production site, so there haven't been any problems) > > > > mySite.components.myComponent > > > > However, now I'm using SVN to automatically FTP changes "on commit" to > > the following structure for the development version of the site: > > > > mySite-dev.components.myComponent > > > > On my server, the production site is under: > > > > mySite.components.myComponent > > > > So, I have two sites online that I need to use depending on whether > > I want to publish to the development version or the production version. > > > > How can I work my paths so they function under each situation? > > > > Thanks! > > > > Rick > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334376 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm