Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    May 2004
    Location
    Minneapolis, MN, USA
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Paths: relative? absolute?

    Are there any factors you delicious people consider when deciding to use relative or absolute paths other than convenience of code?

    By that I mean, one obvious criterion I can think of right away would be where you're several levels deep and need to access something one level deep.

    /levelWeWant/

    is much more sensible than

    ../../../../../levelWeWant/

    Something in my head likes paths absolute paths relative to the root as a general rule. But with the dev setup where I work, dev sites sit in a folder one level deeper than the webroot. So their root during dev is one level off where it will be in production. This can be a simple find and replace action at the end of development, but again... just curious if there's anything else y'alls consider.

    Mewonders if I'm overthinking this one, though.

  • #2
    Senior Coder
    Join Date
    Jul 2004
    Location
    New Zealand
    Posts
    1,315
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by ]|V|[agnus
    But with the dev setup where I work, dev sites sit in a folder one level deeper than the webroot.
    You should be using a subdomain instead, like http://dev.mysite.com
    Forget style. Code to semantics. Seperate style from structure, and structure from behaviour.
    I code to specs, and test only in Firefox (unless stated otherwise).

  • #3
    Regular Coder
    Join Date
    May 2004
    Location
    Minneapolis, MN, USA
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Another wonderfully helpful post from Hemebond!

    In response to your comment: no ****, but I can't fix every ridiculous aspect of an entirely bushleague operation.

    Now, if you or anybody else would like to address the actual point of this thread...


  • #4
    Senior Coder
    Join Date
    Jul 2004
    Location
    New Zealand
    Posts
    1,315
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by ]|V|[agnus
    Another wonderfully helpful post from Hemebond!

    In response to your comment: no ****, but I can't fix every ridiculous aspect of an entirely bushleague operation.
    Chill. Not everyone thinks of using a subdomain (obviously, otherwise you wouldn't be in this mess). What did you want me to say? Use ../../../../../levelWeWant/? That's just stupid. Basically you're stuffed. You'll have to do a find+replace.

    I don't even understand your first question.
    Forget style. Code to semantics. Seperate style from structure, and structure from behaviour.
    I code to specs, and test only in Firefox (unless stated otherwise).

  • #5
    Regular Coder
    Join Date
    Aug 2004
    Location
    The US of A
    Posts
    767
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Best answer:
    Use a subdomain.

    Second best solution:
    Build the site in a self-contained folder. If you require outside libraries, do use a an absolute path.

    I'd reccomend storing all external libraries (such as PHP classes) in a folder that will be universally accessible and using an absolute path for that. As for CSS, just build the site in a self-contained folder and make all paths relative in that.

    Here is an example layout of the filesystem I'm talking about:
    • libraries
      • php
      • perl
      • asp
      • python
      • ruby
      • rails
      • c
    • www
      • dev
        • newsite1
          • imgs
          • styles
          • scripts
        • newsite2
          • imgs
          • styles
          • scripts
      • imgs
      • styles
      • scripts


    This way, when you decide "Ok, newsite1 is done. I think that one should be the new website." You can just change the location of all the files. And all paths will remain intact and working.

  • #6
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    Quote Originally Posted by ]|V|[agnus
    Now, if you or anybody else would like to address the actual point of this thread...
    It's funny, I was having this exact conversation at work today... I like developing locally w/ relative paths, my clients like me developing on a subdomain so they can micromana...check on my progress. And I completely didn't think of the simple fact that I could be using a subdomain. Why? Because I'm a big idiot. So, at least my question has been answered.

  • #7
    Regular Coder
    Join Date
    Aug 2004
    Location
    The US of A
    Posts
    767
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I develop locally as well, but like I said: isolate the work with a generic filesystem. But subdomains are insanely helpful. And even then, I'd reccomend using the same generic filesystem.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •