PDA

View Full Version : File paths, absolute / relative


Tim.g
08-04-2011, 11:18 AM
Hi,
I am new to dreamweaver & webbuild in general. I am in the process of building a site for my sisters business but have a problem.
When I transport the work to a stick then to another PC, it is all displaced. I have been told I need to make all paths relative rather than absolute but havent got a clue how to change this, Can anyone please help?:confused:

Corrosive
08-04-2011, 12:16 PM
Example absolute (to an image but same principals apply);

<img src="http://www.yourdoamin.com/images/yourimage.jpg" />

Example relative (relative to the site root folder)

<img src="images/yourimage.jpg" />

Hope that helps; http://www.corrosiveonline.co.uk/tutorials_folder_structure_file_paths.php

Tim.g
08-04-2011, 12:43 PM
Thanks for the reply, but I am still a bit confused as in my coding for say the header image I have got:
<img src="../shopfront re-size.jpg" width="899" height="108" />

Your example for relative seems to show the containing folder and the image. Whereas mine shows the image & size only.

Corrosive
08-04-2011, 12:54 PM
Did you read the page I linked as well? It is good practice to have a logical site structure, images in an images folder, scripts in a scripts folder, CSS in a CSS folder and so on. If you put your images in an images folder then your path would look like my first example.

basically though, just trace the path to what you want to link to and then construct your links. Then you could use something like 'Find & Replace' to batch run the whole site.

domedia
08-04-2011, 02:18 PM
Example relative (relative to the site root folder)

<img src="images/yourimage.jpg" />


Not exactly. That link is relative to the current location. To have the link relative to the site root folder, you add a backslash to the start of the :

<img src="/images/yourimage.jpg" />

Corrosive
08-04-2011, 02:21 PM
Not exactly. That link is relative to the current location. To have the link relative to the site root folder, you add a backslash to the start of the :

<img src="/images/yourimage.jpg" />

Ooops, yes. Coded that in a rush :oops:

DWcourse
08-04-2011, 07:42 PM
If you move the site to a new computer AND redefine the site on the new computer you should be able to preview from Dreamweaver no matter what type of links you use.

If you want to be able to view the site directly in your browser on another computer or from a flash drive or cd you need to use document relative links.