alpha
06-30-2001, 04:42 PM
When you are designing a site and the site spans over multiple directories... and use the <img src="blah"> tag... do you use 'absolute' paths or relative paths?
Ex. of Absolute Path:
<img src="http://www.yourdomain.com/images/image.gif">
Ex. of Relative Path:
<img src="..\..\images\image.gif">
any good reason to use either one of these? i think the full paths work out better but I see alot of sites using relative paths...
thanks
Ericd
06-30-2001, 04:51 PM
Pros about relative path:
- You can test the site on your hard drive without having to upload the site
- If you change your domain/free space provider, you don't have to change everything from www.domain.com/img/look.gif to www.newdomain.com/img/look.gif.
- WYSIWYG editors format it that way (at least, dreamweaver does it)
Pros about full path:
- Easier (rather than \...\img\look.gif just simply www.domain.com/img/look.gif
that's about it i think
Cheers!
:beer:
alpha
06-30-2001, 06:27 PM
those are some good points...
anyone else have any comments about this topic?
i would like to hear from more people ;)
Jedito
06-30-2001, 06:35 PM
relative I think that is the best.
Because if you want to use that images in all the site, with absolute path you must change it for your SSL forms or you'll get a warning message.
Originally posted by HostAB.com
- Easier (rather than \...\img\look.gif just simply www.domain.com/img/look.gif
Hmm... "http://www.domain.com\" is easier than "..\" ?? ;)
I can't think of any reason not to use relative paths in that situation.
Ericd
06-30-2001, 06:56 PM
Originally posted by JayC
Hmm... "http://www.domain.com\" is easier than "..\" ?? ;)
Let's say you have a file "www.domain.com/hosting/plans/starter/index.html" and you want to include your logo on the page, then www.domain.com/logo.gif or www.domain.com/img/logo.gif is easier than ..\..\..\logo.gif or ..\..\..\img\logo.gif :D
But it depends if the path is long or not, then it mights be easier or not...even though i never use full path anyways :)
Jedito
06-30-2001, 07:11 PM
but again, you can't work with absolute paths if you have SSL without a warning. Or you must have all with https://domain.com/image.jpg
(SH)Saeed
06-30-2001, 07:13 PM
/ = http://www.domain.tld/
so instead of doing "../../../img/file.gif" or "http://www.domain.tld/img/file.gif", you could do "/img/file.gif".