...

View Full Version : Paths: relative? absolute?



]|V|[agnus
08-24-2005, 10: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.

/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. ;)

hemebond
08-24-2005, 11: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

]|V|[agnus
08-24-2005, 11: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...

:thumbsup:

hemebond
08-25-2005, 12:00 AM
|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.

Kurashu
08-25-2005, 12:48 AM
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.

rmedek
08-25-2005, 01: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

Kurashu
08-25-2005, 04: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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum