View Full Version : Paths: relative? absolute?
08-24-2005, 09:44 PM
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.
is much more sensible than
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. ;)
08-24-2005, 10:42 PM
|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
08-24-2005, 10:46 PM
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...
08-24-2005, 11:00 PM
|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.
08-24-2005, 11:48 PM
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:
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.
08-25-2005, 12:51 AM
|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. :D
08-25-2005, 03:54 AM
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.