logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > General
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 03-24-2009, 01:05 PM   #1
ryglover
 
Join Date: Mar 2009
Location: North Saanich, British Columbia, Canada
Posts: 2
Default

Quote:
Originally Posted by davidj View Post
remember 2 dots (..) move you up a level
Hi David,

You sound like you know what you’re talking about when it comes to issues of directory referencing. So, I’d like to bounce this off you:

I have been tasked to take over an existing site that is working just fine online. I’ll call it the “official” site. The previous developers were fired.

So, I used an FTP program to download the entire site and then tried to use that site as the basis for a new DreamWeaver project. I’ll call that new site the “test” site.

I have run into problems. Basically, the “official” site works just fine online now but when I tried to publish the identical site, as downloaded, from DreamWeaver I ran into serious problems:

1. The reference to a CSS main file, from an internal sub-directory, was wrong. So it would not preview correctly, nor did it display correctly on my “test” site.

The reason, as I discovered after reading your post, was that the internal referencing is wrong. Within a sub-directory of the root directory, the reference to the main CSS style sheet was: “/styles.css,” instead of “../styles.css,” as you recommended.

I changed all of the offending pages and the CSS worked just fine.

2. The reference to a main image directory, from an internal sub-directory, was also wrong. It was “/images.”

Again, following your advice to reference a directory above a current directory, I revised all sub-directory pages to use the convention “../images.”

After making these key changes, all of the files worked, as previewed in Dreamweaver and published to an FTP site.

The question, though, is why the current “official” site works just fine online even though these key linkages are incorrectly referenced?

Any ideas?

Thanks,

Ry
------
R. Y. Glover & Associates
EDITORIAL AND MARKETING SERVICES
1455 McTavish Road, North Saanich
British Columbia, Canada, V8L 5T3
Tel: 250-656-1227
Fax: 250-656-1227
Email: randalglover@shaw.ca
Web: http://www.rygloverandassociates.com
ryglover is offline   Reply With Quote
Old 03-24-2009, 01:56 PM   #2
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

This is a absolute path..
Quote:
/images
although its relative in repect of your www root and is interpreted as root/images

so no matter how deep you are in your directory structure by referencing this path you will reference root/images

this however is a relative path
Quote:
../images
this just looks for an images directory above the directory your looking in.

look at this structure

Quote:
root / pages
root / images /
root / images / gifs
root / images / jpgs
root / images / pngs
root / scripts
root / CSS
if i wanted to ref a gif image from the jpgs directory i would write

[relative]
Quote:
../gifs
[absolute] << but relative to your document root
Quote:
/images/gifs
[absolute] << true absolute
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 03-26-2009, 11:40 PM   #3
Rob_Che
Rob_Che's Avatar
 
Join Date: Feb 2008
Posts: 1,552
Default

Wow DJ - that's awesome. I knew what worked but never knew 'why'... cheers.

I tend to use true absolute for sites where the images folders are buried deep - eg wordpress:
www/wp-content/themes/destroyTheme/html/images
Rob_Che is offline   Reply With Quote
Old 03-27-2009, 12:31 AM   #4
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

i think its best practice to use absolute but i was brought up on relative paths and cant shake the habit
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 03-27-2009, 04:08 PM   #5
domedia
Administrator
domedia's Avatar
 
Join Date: Dec 2003
Posts: 9,730
Default

I heard some people say that absolute paths are bullet proof, so less risk.
I'm brought up on relative paths as well, and can't really shake em off either.
domedia is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:15 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com