tags:

views:

38

answers:

4

I have this path and it is correct however, the browser will not include the source file unless I put "file:///" in front of it. I'm still developing and this will ultimately be on a Linux machine but in the mean time, I'd like to see my work as well as be able to troubleshoot it. Is there a solution for this?

This fails:

C:\Program Files (x86)\work\site\js\rowlock.js

This does not fail:

file:///C:\Program Files (x86)\work\site\js\rowlock.js
A: 

just use front slashes everywhere if you'll be moving this to a linux box anyway. php for windows can understand it.

$file='c:/Program Files (x86)/work/site/js/rowlock.js';
stillstanding
Rockjock, I am currently using forward slashes but the file still won't load. The only way I can get the file to load os by putting "file:// in front of the "C:\"
jim
It's highly unlikely that the path will be C:/Program Files (x86)... when this is placed on a Linux machine!
Sohnee
right, but the debugging right now is on a winbox so we need to isolate the problem
stillstanding
+1  A: 

Put quotes around your path. You have spaces, so it is not read correctly.

'C:\Program Files (x86)\work\site\js\rowlock.js'
Andy
Thanks Andy. I have already tried that and get "Illegal url" in the browser.
jim
+1  A: 

Where is Your root folder?

If its C:\Program Files (x86)\work\site\

Then simple access your file like this

js/rowlock.js

This assuming that js is in the Root folder

streetparade
I was hoping to use the absolute path so that if I ever wanted to change the directory structure, it wouldn't be that big of a deal.
jim
+2  A: 

Try using variable $_SERVER['DOCUMENT_ROOT'] to make your script independent. For example:

include($_SERVER['DOCUMENT_ROOT'].'/js/rowlock.js');

Works fine on any system

Silver Light
This is what I think I'm going to have to use after all. Thanks.
jim