> Ideally, you want your local development environment to mirror your
> production environment, so that URLs you use locally will also work in
> production.

In case you're not in the ideal situation...for example, on your dev box you 
have multiple sites via Apache or whatever, which might be located at 
http://localhost/site1/, http://localhost/site2/, etc.

I stole something from Ray Camden that works pretty well.  You set a path in 
your Application.cfm or .cfc file like so:

<cfif cgi.http_host is "localhost">
<cfset application.rooturl = 'http://localhost/siteroot'>
<cfelse>
<cfset application.rooturl = 'http://www.mydomain.com'>
</cfif>

Then you preface all img src attributes with 
#application.rooturl#/pathtoimages/.  You can do a find/replace to expedite 
this.  This way each image src has a fully qualified url (I think that's 
what it's called, could be wrong though) and isn't dependent on the location 
of the calling template.

Once it's in place, your images should be pathed correctly whether you're on 
your local dev box or in production.  You can use this for links, script 
src's, or anywhere else you might use a relative path, where you're not sure 
where it will be called from.

-- Josh 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 by AdobeĀ®
Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. 
Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:276709
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to