By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,688 Members | 1,911 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,688 IT Pros & Developers. It's quick & easy.

relative path wooes

realin
100+
P: 254
hi guys...
its just a simple thing but confusing me like hell.. i donn know why /.

i just want to know how do i set relative paths, lil information can help you :-

my hosting is on linux

what i know is :-

../ would jump level up from the current directory


so here is the directory structure..

i have folders

inc
script
style


so my script file is in "inc" which wants to access a JS file from "script" folderso how do i do it

src="../script/file.js";
or
src=../../script/file.js";

well none of them worked for me..

also my current operating system is WINDOWS, so i will have to change these paths again for my windows or what ?

thanks for ur time :)
Aug 7 '07 #1
Share this Question
Share on Google+
4 Replies


nathj
Expert 100+
P: 938
The first thing that comes to my mind, from my own experience, is that linux is case sensitive. So a file name of 'javafunctions.js' is not the same as a file name of 'JavaFunctions.js'

It sounds really obvious I know, but it's worth mentioing.

Cheers
nathj
Aug 7 '07 #2

realin
100+
P: 254
The first thing that comes to my mind, from my own experience, is that linux is case sensitive. So a file name of 'javafunctions.js' is not the same as a file name of 'JavaFunctions.js'

It sounds really obvious I know, but it's worth mentioing.

Cheers
nathj

thanks a lot for the quick reply, but that is not the case, still i have checked it thoroughly.. I am missing something.. but for instance take this

my css file is lying in root and all the images are lying in img folder so when i write background-image:url(./img/main2.jpg); then it works quite fine.. but not with the javascript or other files like .txt
Aug 7 '07 #3

realin
100+
P: 254
oh my ghosh!! i got it myself only where the problem is

actually the file which exists in inc folder is a function which gets called by a file in teh root, now i was setting path in relative to inc folder but it was suppose to be set for the root..

moderator if wants can delete this thread, but it is useful for the n00bs like me :D
Aug 7 '07 #4

nathj
Expert 100+
P: 938
thanks a lot for the quick reply, but that is not the case, still i have checked it thoroughly.. I am missing something.. but for instance take this

my css file is lying in root and all the images are lying in img folder so when i write background-image:url(./img/main2.jpg); then it works quite fine.. but not with the javascript or other files like .txt
Ok, well it was worth a try.

What happens if you use the absolute path instead? Does that get things working properly for you?

Cheers
nathj

EDIT: The answer (post below) must have been posted while I was typing this oh well. Glad the problem has been solved.
Aug 7 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.