relative path wooes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • realin
    Contributor
    • Feb 2007
    • 254

    relative path wooes

    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 :)
  • nathj
    Recognized Expert Contributor
    • May 2007
    • 937

    #2
    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

    Comment

    • realin
      Contributor
      • Feb 2007
      • 254

      #3
      Originally posted by nathj
      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

      Comment

      • realin
        Contributor
        • Feb 2007
        • 254

        #4
        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

        Comment

        • nathj
          Recognized Expert Contributor
          • May 2007
          • 937

          #5
          Originally posted by realin
          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.

          Comment

          Working...