What I do is set seperate root paths dependant on the $_SERVER
['HTTP_HOST'] in the config file.

if ($_SERVER['HTTP_HOST']=='localhost') $root='/something/dev/';
else $root='/';

On Jan 10, 11:02 pm, Ricardo Tomasi <ricardob...@gmail.com> wrote:
> A simple fix is to create a subdomain for local testing, that way you
> can use a starting slash:
>
> edit your hosts file (system32 on windows, etc/hosts on linux) like
> this:
>
> 127.0.0.1 localhost
> 127.0.0.1 subdomain.localhost
>
> then add a virtual host in your apache.conf:
>
> NameVirtualHost *:80
> <VirtualHost *:80>
>  ServerName subdomain.localhost
>  DocumentRoot "/myfiles" #not sure about this one
>  DirectoryIndex index.php index.html index.html index.htm index.shtml
> </VirtualHost>
>
> On Jan 10, 3:40 pm, "Rick Faircloth" <r...@whitestonemedia.com> wrote:
>
> > Maybe I just haven't tried hard enough to figure out the path
> > situation, but putting "/" at the start of my paths on my dev setup
> > doesn't work.  That causes the path to be:
>
> >http://localhost/login/...
>
> > instead, the path needs to be:
>
> >http://localhost/fortstewart-sm/login/etc., which I get by using ../login
>
> > I have a mapping in ColdFusion that sets "/" and "/localhost" to
> > "e:\inetpub\webroot" on both by dev setup and my server.
>
> > I always figured the need for different setup of paths was due to my dev 
> > setup
> > being "localhost" for http access only and my server being a multi-homed
> > web server.  Putting "/" at the start of a path on my dev setup will always
> > put a directory directly under "http://localhost";, but putting "/" at the
> > start of a logical path on my server puts the directory directly under
> > the websites root folder.
>
> > So, locally, "/login/include_login_form.cfm" translates to
> > "e:\inetpub\webroot\login\include_login_form.cfm", which is wrong.
>
> > On my server, "/login/include_login_form.cfm" translates to
> > "e:\inetpub\webroot\fortstewart-sm\login\include_login_form.cfm", which is 
> > correct.
>
> > Is there something fundamental about paths and mappings that I'm missing 
> > here?
>
> > Rick
>
> > > -----Original Message-----
> > > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
> > > Behalf Of jQuery Lover
> > > Sent: Saturday, January 10, 2009 1:42 AM
> > > To: jquery-en@googlegroups.com
> > > Subject: [jQuery] Re: Is there a way to create Javascript virtual or 
> > > logical path mappings?
>
> > > Why don't you add "/" to your path and it will always work, wherever
> > > you are, on the same lever, below or upper ...
>
> > > jQuery HowTo Resource  -  http://jquery-howto.blogspot.com
>
> > > On Sat, Jan 10, 2009 at 8:04 AM, Rick Faircloth
> > > <r...@whitestonemedia.com> wrote:
>
> > > > I've got login templates that use jQuery and the
> > > > path required depends on the ColdFusion template
> > > > including the jQuery in the page.
>
> > > > For example:
>
> > > > tb_show("Login", 
> > > > "login/login_form.cfm?height=320&width=290&modal=true", false);
>
> > > > This code's path, "login/login_form.cfm", works when included
> > > > from a directory above the "login" directory.
>
> > > > But when it's included in a template that's in a directory
> > > > that's on the same level as the login directory, that path
> > > > won't work.
>
> > > > In ColdFusion, as of version 8, we can create per-application
> > > > logical mappings, such as the example below that works anywhere:
>
> > > > (this.mappings, "/app_login", "e:\inetpub\webroot\fortstewart-sm\login")
>
> > > > And I could just use td_show("Login", "/app_login/login_form.cfm etc...)
> > > > and it would work when included in a template in any location in the 
> > > > tree.
>
> > > > I was wondering if the same thing can be done with jQuery/Javascript
> > > > or if there's another solution so I don't have to do this:
>
> > > > <cfif cgi.script_name contains "index.cfm">
>
> > > >        <td_show("Login", "login/login_form.cfm etc...);
>
> > > > <cfelse>
>
> > > >        <td_show("Login", "../login/login_form.cfm etc...);
>
> > > > </cfif>
>
> > > > Rick

Reply via email to