Dreamweaver template image missing

Hi,

I’m trying to create pages from templates in Dreamweaver cs5.5. I have a background image in the ‘body’ which displays perfectly in the template, but does not show up in any child of the template. I’ve created and saved the templates various ways, and I’ve even used a Dreamweaver Template and just changed the body background colour to ‘none’ and added the image. No other alterations at all the the DW template. The site has been properly saved using ‘Manage Sites’.

I’ve noticed that the image is always given an absolute rather than relative path, which seems a little odd to me, so I’m not sure if this is part of the issue.

I tried doing all the same things using Dreamweaver 8 ( the only other version I have) and everything worked fine, which seems to suggest it’s a CS5.5 issue?

A very simple example can be found here: view-source:http://www.andthecat.co.uk/gill/ybs_test/

Any thoughts please?
Thanks everso

It’s not really clear what that example is meant to show. I’m not familiar with all those Dw functions, but this sort of thing is very easy if you code it yourself. Anyhow, it’s not quite clear (to me at least) what the issue is. Does that site you linked to demonstrate the problem?

Ralph, the code illustrates the problem because it is referencing the hard drive rather than the site structure itself. For whatever reason DW isn’t mirroring the website directory structure with the live site when uploaded. It should theoretically replace the "file:///C|" with the online site value like it is in doing within DW8 for the template.

Though I don’t have DW so cannot really help that much as it’s program specific. Though with an alternative text editor you could easily change/correct the value. But it doesn’t get to the root cause.

To follow up on what Robert said, I think you aren’t fully defining your site in DW so it is doing the file:///. Check the configuration for your site.

If it isn’t in the config, you might have not checked the option to copy the image to your site’s directory when picking it.

Thanks both. I’m doing this over and over again, and each time I’m defining the site through Manage Sites so really don’t think that is the problem. Also, the page loses the background image locally, before I even upload it to the server, so it can’t be that the image isn’t there. I’ve uploaded a new, very simple version which has the same issue at http://www.andthecat.co.uk/gill/test_2/page1.html and I’ve double-checked that clicked ‘upload dependent files.’ Code is as follows:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml”><!-- InstanceBegin template=“/Templates/bgtest.dwt” codeOutsideHTMLIsLocked=“false” –>
<head>
<meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” />
<!-- InstanceBeginEditable name=“doctitle” –>
<title>Untitled Document</title>
<!-- InstanceEndEditable –>
<style type=“text/css”>
#wrap {
background-color: #0CC;
height: 450px;
width: 960px;
margin-top: 50px;
margin-right: auto;
margin-left: auto;
}
body {
background-image: url(file:///C|/Documents and Settings/admin/My Documents/1DREAMWEAVER/2_test/images/1bg1.jpg);
}
</style>
<!-- InstanceBeginEditable name=“head” –>
<!-- InstanceEndEditable –>
</head>

<body>
<div id=“wrap”>Content for id “wrap” Goes Here</div>
</body>
<!-- InstanceEnd –></html>

And the template:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” />
<!-- TemplateBeginEditable name=“doctitle” –>
<title>Untitled Document</title>
<!-- TemplateEndEditable –>
<style type=“text/css”>
#wrap {
background-color: #0CC;
height: 450px;
width: 960px;
margin-top: 50px;
margin-right: auto;
margin-left: auto;
}
body {
background-image: url(…/images/1bg1.jpg);
}
</style>
<!-- TemplateBeginEditable name=“head” –>
<!-- TemplateEndEditable –>
</head>

<body>
<div id=“wrap”>Content for id “wrap” Goes Here</div>
</body>
</html>

As I mentioned before, I have tried recreating this in Dreamweaver 8, going through exactly the same process and have had no problem there. It’s feeling horribly as if this is a software issue but I can’t believe that. It must be me!

The culprit is:

background: (file:///C|/Documents and Settings/admin/My Documents/1DREAMWEAVER/2_test/images/1bg1.jpg);

I am guessing that 1bg1 is in your images directory. I am assuming you

[list]
[]clicked the + in the Css panel
[
]chose tag in the selector type
[]chose/typed body in the drop down
[
]clicked the background category
[*]Clicked “browse”[/list]
Two things

  1. Was your file saved BEFORE you did the steps above?
  2. What did you set the “relative to” drop down as?

Also it looks like on your server the directory is test_2 but on your computer it is 2_test.

Wow, Ryan, we’re not quite there, but certainly closer!

Ok, I started again from scratch ( again!) following all your steps - which were in fact exactly what I’d done before - until I reached the ‘relative to’ dropdown, which I’ve never noticed before. This has always been set to ‘document’ so this time I tried ‘site root’. And this time, the child page did display the background image, which has not happened before. So I got very excited!

The problem came when I tried uploading it. This time I created a new directory, both locally and on the server, called ‘sitepoint’. I ensured that the image is there. But somehow they aren’t connecting. I’m sure we’re so close, but can you just help me get to the end?

New site http://www.andthecat.co.uk/gill/sitepoint/child1.html

Can you also explain to me about the ‘relative to’ dropdown, and when I should set it to something other than document? Or point me to somewhere I can read up on it?

Thanks so much.

13adge

Not sure why, but the image path reads

url("[COLOR="#FF0000"]/www[/COLOR]/gill/sitepoint/images/1bg1.jpg")

when it should be

url("/gill/sitepoint/images/1bg1.jpg")

I guess the folder structure online is different from on your desktop.

Right. Well I’ve now tried all sorts of different settings. As the problem is occurring locally, before I post the site, it suggests to me that it isn’t an issue with the server. But I’ve created new templates with different images and put them on different servers, and I still have the issue. I have made sure my images folder is defined in the advanced Manage Sites options. I@ve also tried ticking and unticking the ‘don’t rewrite relative document paths’ box in the templates options. So…

first of all, could someone tell me whether the ‘Relative to’ drop-down should be set to Document or Site Root,
could you also let me know how all the other setting should be set
Finally, I seem to be finding a lot of forum questions similar to mine, but no answers. COuld someone please put my mind at rest and confirm that they are using Dreamweaver 5.5 and have had no problems with background images failing to show? At least then we will know there IS a solution, and it’s just that we can’t find it.

(And if anyone from Adobe is out there, please help? Someone must know the answer?)

Thanks all for trying. Really appreciate your patience.

hi there.

when this happens the problem is usual simple to resolve. what you need to do is before saving your template you need to export your css styles.

so, delete any template you have now with the embedded css and before creating a new temp from your original html page go to your css styles panel and select all your styles (everything below <style> ctrl shift) now right click and select move css rules, select new rules in the pop up box, name it and save. now go back and create a template with you original html page…

your styles are now in code as a pointer pointing at the external css (one line of code) and not embedded with 10, 20, 30 separate paths pointing at images and styles.